diff --git a/docs/docfx.json b/docs/docfx.json index da0c58cac8..232d8768eb 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -23,6 +23,7 @@ "files": [ "api/**.yml", "api/index.md", + "ext/openapi/index.md", "getting-started/**.md", "getting-started/**/toc.yml", "usage/**.md", diff --git a/docs/ext/openapi/index.md b/docs/ext/openapi/index.md new file mode 100644 index 0000000000..99ac49c3f2 --- /dev/null +++ b/docs/ext/openapi/index.md @@ -0,0 +1,127 @@ +# JSON:API Extension for OpenAPI + +This extension facilitates using OpenAPI client generators targeting JSON:API documents. + +In JSON:API, a resource object contains the `type` member, which defines the structure of nested [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects. +While OpenAPI supports such constraints using `allOf` inheritance with a discriminator property for the `data` member, +it provides no way to express that the discriminator recursively applies to nested objects. + +This extension addresses that limitation by defining additional discriminator properties to guide code generation tools. + +## URI + +This extension has the URI `https://www.jsonapi.net/ext/openapi`. +Because code generators often choke on the double quotes in `Accept` and `Content-Type` HTTP header values, a relaxed form is also permitted: `openapi`. + +For example, the following `Content-Type` header: + +```http +Content-Type: application/vnd.api+json; ext="https://www.jsonapi.net/ext/openapi" +``` + +is equivalent to: + +```http +Content-Type: application/vnd.api+json; ext=openapi +``` + +To avoid the need for double quotes when multiple extensions are used, the following relaxed form can be used: + +```http +Content-Type: application/vnd.api+json; ext=openapi; ext=atomic +``` + +> [!NOTE] +> The [base specification](https://jsonapi.org/format/#media-type-parameter-rules) *forbids* the use of multiple `ext` parameters +> and *requires* that each extension name must be a URI. +> This extension relaxes both constraints for practical reasons, to workaround bugs in client generators that produce broken code otherwise. + +## Namespace + +This extension uses the namespace `openapi`. + +> [!NOTE] +> JSON:API extensions can only introduce new document members using a reserved namespace as a prefix. + +## Document Structure + +A document that supports this extension MAY include any of the top-level members allowed by the base specification, +including any members defined in the [Atomic Operations extension](https://jsonapi.org/ext/atomic/). + +### Resource Objects + +In addition to the members allowed by the base specification, the following member MAY be included +in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects: + +* `openapi:discriminator` - A string that MUST be identical to the `type` member in the containing [resource object](https://jsonapi.org/format/#document-resource-objects). + +Here's how an article (i.e. a resource of type "articles") might appear in a document: + +```json +{ + "data": { + "type": "articles", + "id": "1", + "attributes": { + "openapi:discriminator": "articles", + "title": "Rails is Omakase" + }, + "relationships": { + "openapi:discriminator": "articles", + "author": { + "data": { "type": "people", "id": "9" } + } + } + } +} +``` + +### Atomic Operations + +In addition to the members allowed by the [Atomic Operations extension](https://jsonapi.org/ext/atomic/), +the following member MAY be included in elements of an `atomic:operations` array: + +* `openapi:discriminator` - A free-format string to facilitate generation of client code. + +For example: + +```http +POST /operations HTTP/1.1 +Host: example.org +Content-Type: application/vnd.api+json; ext="https://www.jsonapi.net/ext/openapi https://jsonapi.org/ext/atomic" +Accept: application/vnd.api+json; ext="https://www.jsonapi.net/ext/openapi https://jsonapi.org/ext/atomic" + +{ + "atomic:operations": [{ + "openapi:discriminator": "add-article", + "op": "add", + "data": { + "type": "articles", + "attributes": { + "openapi:discriminator": "articles", + "title": "JSON API paints my bikeshed!" + } + } + }] +} +``` + +## Processing + +A server MAY ignore the `openapi:discriminator` member in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects from incoming requests. +A server SHOULD ignore the `openapi:discriminator` member in elements of an `atomic:operations` array. + +A server MUST include the `openapi:discriminator` member in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects in outgoing responses. +The member value MUST be the same as the `type` member value of the containing resource object. + +A client MAY include the `openapi:discriminator` member in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects in outgoing requests. +The member value MUST be the same as the `type` member value of the containing resource object. + +A client MAY include the `openapi:discriminator` member in elements of an `atomic:operations` array. + +### Processing Errors + +A server SHOULD validate that the value of the `openapi:discriminator` member in +[attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects +is identical to the `type` member in the containing resource object. When validation fails, the server MUST respond with a `409 Conflict` +and SHOULD include a document with a top-level `errors` member that contains an error object. diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json index 6eab88e043..4863000598 100644 --- a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -20,7 +20,7 @@ "requestBody": { "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "allOf": [ { @@ -36,7 +36,7 @@ "200": { "description": "All operations were successfully applied, which resulted in additional changes.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/operationsResponseDocument" } @@ -49,7 +49,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -59,7 +59,7 @@ "403": { "description": "An operation is not accessible or a client-generated ID is used.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -69,7 +69,7 @@ "404": { "description": "A resource or a related resource does not exist.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -79,7 +79,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -89,7 +89,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -142,7 +142,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/personCollectionResponseDocument" } @@ -164,7 +164,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -265,7 +265,7 @@ "requestBody": { "description": "The attributes and relationships of the person to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -291,9 +291,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/personPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryPersonResponseDocument" } } } @@ -304,7 +304,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -314,7 +314,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -324,7 +324,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -334,7 +334,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -344,7 +344,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -408,9 +408,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/personPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryPersonResponseDocument" } } } @@ -430,7 +430,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -440,7 +440,7 @@ "404": { "description": "The person does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -566,7 +566,7 @@ "requestBody": { "description": "The attributes and relationships of the person to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -582,9 +582,9 @@ "200": { "description": "The person was successfully updated, which resulted in additional changes. The updated person is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/personPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryPersonResponseDocument" } } } @@ -595,7 +595,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -605,7 +605,7 @@ "404": { "description": "The person or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -615,7 +615,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -625,7 +625,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -660,7 +660,7 @@ "404": { "description": "The person does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -724,7 +724,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/todoItemCollectionResponseDocument" } @@ -746,7 +746,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -756,7 +756,7 @@ "404": { "description": "The person does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -902,7 +902,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/todoItemIdentifierCollectionResponseDocument" } @@ -924,7 +924,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -934,7 +934,7 @@ "404": { "description": "The person does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1047,7 +1047,7 @@ "requestBody": { "description": "The identities of the todoItems to add to the assignedTodoItems relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1066,7 +1066,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1076,7 +1076,7 @@ "404": { "description": "The person or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1086,7 +1086,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1096,7 +1096,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1127,7 +1127,7 @@ "requestBody": { "description": "The identities of the todoItems to assign to the assignedTodoItems relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1146,7 +1146,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1156,7 +1156,7 @@ "404": { "description": "The person or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1166,7 +1166,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1176,7 +1176,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1207,7 +1207,7 @@ "requestBody": { "description": "The identities of the todoItems to remove from the assignedTodoItems relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1226,7 +1226,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1236,7 +1236,7 @@ "404": { "description": "The person or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1246,7 +1246,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1256,7 +1256,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1320,7 +1320,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/todoItemCollectionResponseDocument" } @@ -1342,7 +1342,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1352,7 +1352,7 @@ "404": { "description": "The person does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1498,7 +1498,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/todoItemIdentifierCollectionResponseDocument" } @@ -1520,7 +1520,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1530,7 +1530,7 @@ "404": { "description": "The person does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1643,7 +1643,7 @@ "requestBody": { "description": "The identities of the todoItems to add to the ownedTodoItems relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1662,7 +1662,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1672,7 +1672,7 @@ "404": { "description": "The person or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1682,7 +1682,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1692,7 +1692,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1723,7 +1723,7 @@ "requestBody": { "description": "The identities of the todoItems to assign to the ownedTodoItems relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1742,7 +1742,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1752,7 +1752,7 @@ "404": { "description": "The person or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1762,7 +1762,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1772,7 +1772,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1803,7 +1803,7 @@ "requestBody": { "description": "The identities of the todoItems to remove from the ownedTodoItems relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1822,7 +1822,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1832,7 +1832,7 @@ "404": { "description": "The person or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1842,7 +1842,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1852,7 +1852,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1905,7 +1905,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/tagCollectionResponseDocument" } @@ -1927,7 +1927,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2028,7 +2028,7 @@ "requestBody": { "description": "The attributes and relationships of the tag to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2054,9 +2054,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/tagPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTagResponseDocument" } } } @@ -2067,7 +2067,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2077,7 +2077,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2087,7 +2087,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2097,7 +2097,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2107,7 +2107,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2171,9 +2171,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/tagPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTagResponseDocument" } } } @@ -2193,7 +2193,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2203,7 +2203,7 @@ "404": { "description": "The tag does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2329,7 +2329,7 @@ "requestBody": { "description": "The attributes and relationships of the tag to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2345,9 +2345,9 @@ "200": { "description": "The tag was successfully updated, which resulted in additional changes. The updated tag is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/tagPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTagResponseDocument" } } } @@ -2358,7 +2358,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2368,7 +2368,7 @@ "404": { "description": "The tag or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2378,7 +2378,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2388,7 +2388,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2423,7 +2423,7 @@ "404": { "description": "The tag does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2487,7 +2487,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/todoItemCollectionResponseDocument" } @@ -2509,7 +2509,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2519,7 +2519,7 @@ "404": { "description": "The tag does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2665,7 +2665,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/todoItemIdentifierCollectionResponseDocument" } @@ -2687,7 +2687,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2697,7 +2697,7 @@ "404": { "description": "The tag does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2810,7 +2810,7 @@ "requestBody": { "description": "The identities of the todoItems to add to the todoItems relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2829,7 +2829,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2839,7 +2839,7 @@ "404": { "description": "The tag or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2849,7 +2849,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2859,7 +2859,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2890,7 +2890,7 @@ "requestBody": { "description": "The identities of the todoItems to assign to the todoItems relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2909,7 +2909,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2919,7 +2919,7 @@ "404": { "description": "The tag or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2929,7 +2929,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2939,7 +2939,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2970,7 +2970,7 @@ "requestBody": { "description": "The identities of the todoItems to remove from the todoItems relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2989,7 +2989,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2999,7 +2999,7 @@ "404": { "description": "The tag or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3009,7 +3009,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3019,7 +3019,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3072,7 +3072,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/todoItemCollectionResponseDocument" } @@ -3094,7 +3094,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3195,7 +3195,7 @@ "requestBody": { "description": "The attributes and relationships of the todoItem to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3221,9 +3221,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/todoItemPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTodoItemResponseDocument" } } } @@ -3234,7 +3234,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3244,7 +3244,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3254,7 +3254,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3264,7 +3264,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3274,7 +3274,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3338,9 +3338,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/todoItemPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTodoItemResponseDocument" } } } @@ -3360,7 +3360,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3370,7 +3370,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3496,7 +3496,7 @@ "requestBody": { "description": "The attributes and relationships of the todoItem to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3512,9 +3512,9 @@ "200": { "description": "The todoItem was successfully updated, which resulted in additional changes. The updated todoItem is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/todoItemPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTodoItemResponseDocument" } } } @@ -3525,7 +3525,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3535,7 +3535,7 @@ "404": { "description": "The todoItem or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3545,7 +3545,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3555,7 +3555,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3590,7 +3590,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3654,9 +3654,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullablePersonSecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryPersonResponseDocument" } } } @@ -3676,7 +3676,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3686,7 +3686,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3832,7 +3832,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullablePersonIdentifierResponseDocument" } @@ -3854,7 +3854,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3864,7 +3864,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3977,7 +3977,7 @@ "requestBody": { "description": "The identity of the person to assign to the assignee relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3996,7 +3996,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4006,7 +4006,7 @@ "404": { "description": "The todoItem or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4016,7 +4016,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4026,7 +4026,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4090,9 +4090,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/personSecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryPersonResponseDocument" } } } @@ -4112,7 +4112,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4122,7 +4122,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4268,7 +4268,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/personIdentifierResponseDocument" } @@ -4290,7 +4290,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4300,7 +4300,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4413,7 +4413,7 @@ "requestBody": { "description": "The identity of the person to assign to the owner relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4432,7 +4432,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4442,7 +4442,7 @@ "404": { "description": "The todoItem or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4452,7 +4452,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4462,7 +4462,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4526,7 +4526,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/tagCollectionResponseDocument" } @@ -4548,7 +4548,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4558,7 +4558,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4704,7 +4704,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/tagIdentifierCollectionResponseDocument" } @@ -4726,7 +4726,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4736,7 +4736,7 @@ "404": { "description": "The todoItem does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4849,7 +4849,7 @@ "requestBody": { "description": "The identities of the tags to add to the tags relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4868,7 +4868,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4878,7 +4878,7 @@ "404": { "description": "The todoItem or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4888,7 +4888,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4898,7 +4898,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4929,7 +4929,7 @@ "requestBody": { "description": "The identities of the tags to assign to the tags relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4948,7 +4948,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4958,7 +4958,7 @@ "404": { "description": "The todoItem or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4968,7 +4968,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4978,7 +4978,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -5009,7 +5009,7 @@ "requestBody": { "description": "The identities of the tags to remove from the tags relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -5028,7 +5028,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -5038,7 +5038,7 @@ "404": { "description": "The todoItem or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -5048,7 +5048,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -5058,7 +5058,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -5287,7 +5287,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } ] }, @@ -5302,101 +5302,305 @@ "additionalProperties": false }, "attributesInCreatePersonRequest": { - "required": [ - "lastName" - ], - "type": "object", - "properties": { - "firstName": { - "type": "string", - "nullable": true + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "lastName": { - "type": "string" + { + "required": [ + "lastName" + ], + "type": "object", + "properties": { + "firstName": { + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInCreateTagRequest": { + "attributesInCreateRequest": { "required": [ - "name" + "openapi:discriminator" ], "type": "object", "properties": { - "name": { - "minLength": 1, - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/attributesInCreatePersonRequest", + "tags": "#/components/schemas/attributesInCreateTagRequest", + "todoItems": "#/components/schemas/attributesInCreateTodoItemRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateTagRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "attributesInCreateTodoItemRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "description", + "priority" + ], + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "priority": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemPriority" + } + ] + }, + "durationInHours": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInPersonResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "firstName": { + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "displayName": { + "type": "string", + "readOnly": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { "required": [ - "description", - "priority" + "openapi:discriminator" ], "type": "object", "properties": { - "description": { - "type": "string" - }, - "priority": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/todoItemPriority" + "$ref": "#/components/schemas/resourceType" } ] - }, - "durationInHours": { - "type": "integer", - "format": "int64", - "nullable": true } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/attributesInPersonResponse", + "tags": "#/components/schemas/attributesInTagResponse", + "todoItems": "#/components/schemas/attributesInTodoItemResponse" + } + }, + "x-abstract": true + }, + "attributesInTagResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "attributesInUpdatePersonRequest": { - "type": "object", - "properties": { - "firstName": { - "type": "string", - "nullable": true + "attributesInTodoItemResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "lastName": { - "type": "string" + { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "priority": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemPriority" + } + ] + }, + "durationInHours": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateTagRequest": { - "type": "object", - "properties": { - "name": { - "minLength": 1, - "type": "string" + "attributesInUpdatePersonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "firstName": { + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateTodoItemRequest": { + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "description": { - "type": "string" - }, - "priority": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/todoItemPriority" + "$ref": "#/components/schemas/resourceType" } ] - }, - "durationInHours": { - "type": "integer", - "format": "int64", - "nullable": true } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/attributesInUpdatePersonRequest", + "tags": "#/components/schemas/attributesInUpdateTagRequest", + "todoItems": "#/components/schemas/attributesInUpdateTodoItemRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateTagRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateTodoItemRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "priority": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemPriority" + } + ] + }, + "durationInHours": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "createPersonOperation": { @@ -5565,296 +5769,345 @@ "additionalProperties": false }, "dataInCreatePersonRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/personResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreatePersonRequest" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreatePersonRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreatePersonRequest" + } + ] } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreatePersonRequest" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreateTagRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/tagResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateTagRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateTagRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTagRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTagRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreateTodoItemRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/todoItemResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateTodoItemRequest" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTodoItemRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTodoItemRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInPersonResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateTodoItemRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInPersonResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInPersonResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInTagResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTagResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInTagResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInResponse": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceType" - } - ] + "dataInTodoItemResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTodoItemResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInTodoItemResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "people": "#/components/schemas/personDataInResponse", - "tags": "#/components/schemas/tagDataInResponse", - "todoItems": "#/components/schemas/todoItemDataInResponse" + }, + "additionalProperties": false } - }, - "x-abstract": true + ], + "additionalProperties": false }, "dataInUpdatePersonRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/personResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdatePersonRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdatePersonRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdatePersonRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdatePersonRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInUpdateTagRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/tagResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateTagRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateTagRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTagRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTagRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInUpdateTodoItemRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/todoItemResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateTodoItemRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateTodoItemRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTodoItemRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTodoItemRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "deletePersonOperation": { @@ -6075,6 +6328,38 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/personIdentifierInRequest", + "tags": "#/components/schemas/tagIdentifierInRequest", + "todoItems": "#/components/schemas/todoItemIdentifierInRequest" + } + }, + "x-abstract": true + }, "meta": { "type": "object", "additionalProperties": { @@ -6113,7 +6398,7 @@ }, "additionalProperties": false }, - "nullablePersonSecondaryResponseDocument": { + "nullableSecondaryPersonResponseDocument": { "required": [ "data", "links" @@ -6130,7 +6415,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/personDataInResponse" + "$ref": "#/components/schemas/dataInPersonResponse" } ], "nullable": true @@ -6138,7 +6423,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -6296,23 +6581,6 @@ ], "type": "string" }, - "personAttributesInResponse": { - "type": "object", - "properties": { - "firstName": { - "type": "string", - "nullable": true - }, - "lastName": { - "type": "string" - }, - "displayName": { - "type": "string", - "readOnly": true - } - }, - "additionalProperties": false - }, "personCollectionResponseDocument": { "required": [ "data", @@ -6327,92 +6595,17 @@ } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/personDataInResponse" - } - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "personDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/personAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/personRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, - "personIdentifierInRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/personResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInPersonResponse" + } }, - "lid": { - "minLength": 1, - "type": "string" + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -6424,6 +6617,30 @@ }, "additionalProperties": false }, + "personIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "personIdentifierInResponse": { "required": [ "id", @@ -6523,7 +6740,13 @@ ], "type": "string" }, - "personPrimaryResponseDocument": { + "personResourceType": { + "enum": [ + "people" + ], + "type": "string" + }, + "primaryPersonResponseDocument": { "required": [ "data", "links" @@ -6540,14 +6763,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/personDataInResponse" + "$ref": "#/components/schemas/dataInPersonResponse" } ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -6560,33 +6783,44 @@ }, "additionalProperties": false }, - "personRelationshipsInResponse": { + "primaryTagResponseDocument": { + "required": [ + "data", + "links" + ], "type": "object", "properties": { - "ownedTodoItems": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { "allOf": [ { - "$ref": "#/components/schemas/toManyTodoItemInResponse" + "$ref": "#/components/schemas/dataInTagResponse" } ] }, - "assignedTodoItems": { + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyTodoItemInResponse" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false }, - "personResourceType": { - "enum": [ - "people" - ], - "type": "string" - }, - "personSecondaryResponseDocument": { + "primaryTodoItemResponseDocument": { "required": [ "data", "links" @@ -6603,14 +6837,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/personDataInResponse" + "$ref": "#/components/schemas/dataInTodoItemResponse" } ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -6636,126 +6870,333 @@ "additionalProperties": false }, "relationshipsInCreatePersonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "ownedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + }, + "assignedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "ownedTodoItems": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyTodoItemInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/relationshipsInCreatePersonRequest", + "tags": "#/components/schemas/relationshipsInCreateTagRequest", + "todoItems": "#/components/schemas/relationshipsInCreateTodoItemRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateTagRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "assignedTodoItems": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTodoItemInRequest" + { + "type": "object", + "properties": { + "todoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationshipsInCreateTagRequest": { + "relationshipsInCreateTodoItemRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "owner" + ], + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOnePersonInRequest" + } + ] + }, + "assignee": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOnePersonInRequest" + } + ] + }, + "tags": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInPersonResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "ownedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInResponse" + } + ] + }, + "assignedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "todoItems": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyTodoItemInRequest" + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/relationshipsInPersonResponse", + "tags": "#/components/schemas/relationshipsInTagResponse", + "todoItems": "#/components/schemas/relationshipsInTodoItemResponse" + } + }, + "x-abstract": true + }, + "relationshipsInTagResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "todoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInTodoItemResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOnePersonInResponse" + } + ] + }, + "assignee": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOnePersonInResponse" + } + ] + }, + "tags": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdatePersonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "ownedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + }, + "assignedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationshipsInCreateTodoItemRequest": { + "relationshipsInUpdateRequest": { "required": [ - "owner" + "openapi:discriminator" ], "type": "object", "properties": { - "owner": { - "allOf": [ - { - "$ref": "#/components/schemas/toOnePersonInRequest" - } - ] - }, - "assignee": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOnePersonInRequest" - } - ] - }, - "tags": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyTagInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false - }, - "relationshipsInUpdatePersonRequest": { - "type": "object", - "properties": { - "ownedTodoItems": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTodoItemInRequest" - } - ] - }, - "assignedTodoItems": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTodoItemInRequest" - } - ] + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/relationshipsInUpdatePersonRequest", + "tags": "#/components/schemas/relationshipsInUpdateTagRequest", + "todoItems": "#/components/schemas/relationshipsInUpdateTodoItemRequest" } }, - "additionalProperties": false + "x-abstract": true }, "relationshipsInUpdateTagRequest": { - "type": "object", - "properties": { - "todoItems": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTodoItemInRequest" + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "todoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationshipsInUpdateTodoItemRequest": { - "type": "object", - "properties": { - "owner": { - "allOf": [ - { - "$ref": "#/components/schemas/toOnePersonInRequest" - } - ] - }, - "assignee": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOnePersonInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "tags": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTagInRequest" + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOnePersonInRequest" + } + ] + }, + "assignee": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOnePersonInRequest" + } + ] + }, + "tags": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "removeFromPersonAssignedTodoItemsRelationshipOperation": { @@ -6986,71 +7427,51 @@ }, "additionalProperties": false }, - "resourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourceTopLevelLinks": { + "resourceInCreateRequest": { + "required": [ + "type" + ], "type": "object", "properties": { - "self": { - "type": "string" + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, - "describedby": { - "type": "string" + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, - "additionalProperties": false - }, - "resourceType": { - "enum": [ - "people", - "tags", - "todoItems" - ], - "type": "string" - }, - "tagAttributesInResponse": { - "type": "object", - "properties": { - "name": { - "minLength": 1, - "type": "string" + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/dataInCreatePersonRequest", + "tags": "#/components/schemas/dataInCreateTagRequest", + "todoItems": "#/components/schemas/dataInCreateTodoItemRequest" } }, - "additionalProperties": false + "x-abstract": true }, - "tagCollectionResponseDocument": { + "resourceInResponse": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceType" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tagDataInResponse" - } - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -7059,71 +7480,30 @@ ] } }, - "additionalProperties": false - }, - "tagDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/tagAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/tagRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/dataInPersonResponse", + "tags": "#/components/schemas/dataInTagResponse", + "todoItems": "#/components/schemas/dataInTodoItemResponse" } - ], - "additionalProperties": false + }, + "x-abstract": true }, - "tagIdentifierCollectionResponseDocument": { + "resourceInUpdateRequest": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceType" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tagIdentifierInResponse" - } - }, "meta": { "allOf": [ { @@ -7132,29 +7512,72 @@ ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/dataInUpdatePersonRequest", + "tags": "#/components/schemas/dataInUpdateTagRequest", + "todoItems": "#/components/schemas/dataInUpdateTodoItemRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, "additionalProperties": false }, - "tagIdentifierInRequest": { + "resourceType": { + "enum": [ + "people", + "tags", + "todoItems" + ], + "type": "string" + }, + "secondaryPersonResponseDocument": { "required": [ - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/tagResourceType" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInPersonResponse" + } + ] }, - "lid": { - "minLength": 1, - "type": "string" + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -7166,24 +7589,31 @@ }, "additionalProperties": false }, - "tagIdentifierInResponse": { + "tagCollectionResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/tagResourceType" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInTagResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -7195,7 +7625,7 @@ }, "additionalProperties": false }, - "tagPrimaryResponseDocument": { + "tagIdentifierCollectionResponseDocument": { "required": [ "data", "links" @@ -7205,21 +7635,14 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/tagDataInResponse" - } - ] - }, - "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/tagIdentifierInResponse" } }, "meta": { @@ -7232,13 +7655,53 @@ }, "additionalProperties": false }, - "tagRelationshipsInResponse": { + "tagIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "tagIdentifierInResponse": { + "required": [ + "id", + "type" + ], "type": "object", "properties": { - "todoItems": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/tagResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyTodoItemInResponse" + "$ref": "#/components/schemas/meta" } ] } @@ -7475,36 +7938,6 @@ ], "type": "string" }, - "todoItemAttributesInResponse": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "priority": { - "allOf": [ - { - "$ref": "#/components/schemas/todoItemPriority" - } - ] - }, - "durationInHours": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "nullable": true - } - }, - "additionalProperties": false - }, "todoItemCollectionResponseDocument": { "required": [ "data", @@ -7522,13 +7955,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/todoItemDataInResponse" + "$ref": "#/components/schemas/dataInTodoItemResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -7541,49 +7974,6 @@ }, "additionalProperties": false }, - "todoItemDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/todoItemAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/todoItemRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "todoItemIdentifierCollectionResponseDocument": { "required": [ "data", @@ -7615,35 +8005,27 @@ "additionalProperties": false }, "todoItemIdentifierInRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/todoItemResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "todoItemIdentifierInResponse": { @@ -7714,43 +8096,6 @@ ], "type": "string" }, - "todoItemPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/todoItemDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "todoItemPriority": { "enum": [ "High", @@ -7759,33 +8104,6 @@ ], "type": "string" }, - "todoItemRelationshipsInResponse": { - "type": "object", - "properties": { - "owner": { - "allOf": [ - { - "$ref": "#/components/schemas/toOnePersonInResponse" - } - ] - }, - "assignee": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOnePersonInResponse" - } - ] - }, - "tags": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTagInResponse" - } - ] - } - }, - "additionalProperties": false - }, "todoItemResourceType": { "enum": [ "todoItems" diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Operations/OperationsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Operations/OperationsRequestBuilder.cs index fb02223ca3..96f21c5a24 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Operations/OperationsRequestBuilder.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Operations/OperationsRequestBuilder.cs @@ -75,8 +75,8 @@ public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExa _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); return requestInfo; } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs index bde26de974..7bcc782af9 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual person by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -90,7 +90,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -107,7 +107,7 @@ public async Task HeadAsync(Action /// Updates an existing person. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -115,7 +115,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -126,7 +126,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -138,7 +138,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Creates a new person. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual tag by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -83,7 +83,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TagPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -100,7 +100,7 @@ public async Task HeadAsync(Action /// Updates an existing tag. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -108,7 +108,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -119,7 +119,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TagPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -131,7 +131,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Creates a new tag. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TagPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related person of an individual todoItem's assignee relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public AssigneeRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : b { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.NullablePersonSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableSecondaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related person of an individual todoItem's owner relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public OwnerRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.SecondaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual todoItem by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -97,7 +97,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -114,7 +114,7 @@ public async Task HeadAsync(Action /// Updates an existing todoItem. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -122,7 +122,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -133,7 +133,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -145,7 +145,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Creates a new todoItem. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(ActionThe data property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse? Data + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } @@ -59,7 +59,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } @@ -71,7 +71,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("data", Data); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreatePersonRequest.cs index 4ce9e0ce20..b26154383a 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreatePersonRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreatePersonRequest : IBackedModel, IParsable + public partial class AttributesInCreatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The firstName property public string? FirstName { @@ -32,20 +28,12 @@ public string? LastName set { BackingStore?.Set("lastName", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreatePersonRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest(); @@ -55,9 +43,9 @@ public AttributesInCreatePersonRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "firstName", n => { FirstName = n.GetStringValue(); } }, { "lastName", n => { LastName = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("firstName", FirstName); writer.WriteStringValue("lastName", LastName); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..19fb0fdd8b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTagRequest.cs index 2aea4ba963..b191d1ad18 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTagRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateTagRequest : IBackedModel, IParsable + public partial class AttributesInCreateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -25,20 +21,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateTagRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest(); @@ -48,9 +36,9 @@ public AttributesInCreateTagRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTodoItemRequest.cs index 0b3c59029d..d783a50dfa 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTodoItemRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateTodoItemRequest : IBackedModel, IParsable + public partial class AttributesInCreateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -39,20 +35,12 @@ public long? DurationInHours set { BackingStore?.Set("priority", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateTodoItemRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest(); @@ -62,9 +50,9 @@ public AttributesInCreateTodoItemRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "durationInHours", n => { DurationInHours = n.GetLongValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteLongValue("durationInHours", DurationInHours); writer.WriteEnumValue("priority", Priority); diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAttributesInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInPersonResponse.cs similarity index 70% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAttributesInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInPersonResponse.cs index b2b829ee13..ab1156dd4a 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAttributesInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInPersonResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PersonAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInPersonResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The displayName property public string? DisplayName { @@ -39,32 +35,24 @@ public string? LastName set { BackingStore?.Set("lastName", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public PersonAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAttributesInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "displayName", n => { DisplayName = n.GetStringValue(); } }, { "firstName", n => { FirstName = n.GetStringValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("firstName", FirstName); writer.WriteStringValue("lastName", LastName); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..6ff4a6df92 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagAttributesInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTagResponse.cs similarity index 63% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagAttributesInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTagResponse.cs index 6887fda2d5..1c17475540 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagAttributesInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTagResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TagAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInTagResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -25,32 +21,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public TagAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagAttributesInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAttributesInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTodoItemResponse.cs similarity index 77% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAttributesInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTodoItemResponse.cs index c48d500bf6..e3d822bc8d 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAttributesInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTodoItemResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TodoItemAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInTodoItemResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The createdAt property public DateTimeOffset? CreatedAt { @@ -53,32 +49,24 @@ public DateTimeOffset? ModifiedAt set { BackingStore?.Set("priority", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public TodoItemAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAttributesInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "createdAt", n => { CreatedAt = n.GetDateTimeOffsetValue(); } }, { "description", n => { Description = n.GetStringValue(); } }, @@ -92,9 +80,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDateTimeOffsetValue("createdAt", CreatedAt); writer.WriteStringValue("description", Description); writer.WriteLongValue("durationInHours", DurationInHours); diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdatePersonRequest.cs index 0f1c5fe130..eac162ccac 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdatePersonRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdatePersonRequest : IBackedModel, IParsable + public partial class AttributesInUpdatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The firstName property public string? FirstName { @@ -32,20 +28,12 @@ public string? LastName set { BackingStore?.Set("lastName", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdatePersonRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdatePersonRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "firstName", n => { FirstName = n.GetStringValue(); } }, { "lastName", n => { LastName = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("firstName", FirstName); writer.WriteStringValue("lastName", LastName); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..3da7558632 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTagRequest.cs index 08a158f8e4..4f09c54701 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTagRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateTagRequest : IBackedModel, IParsable + public partial class AttributesInUpdateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -25,20 +21,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateTagRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest(); @@ -48,9 +36,9 @@ public AttributesInUpdateTagRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTodoItemRequest.cs index 60e1ff77ac..bac8e0a4d9 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTodoItemRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateTodoItemRequest : IBackedModel, IParsable + public partial class AttributesInUpdateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -39,20 +35,12 @@ public long? DurationInHours set { BackingStore?.Set("priority", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateTodoItemRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest(); @@ -62,9 +50,9 @@ public AttributesInUpdateTodoItemRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "durationInHours", n => { DurationInHours = n.GetLongValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteLongValue("durationInHours", DurationInHours); writer.WriteEnumValue("priority", Priority); diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs index 2944d626e5..a73695584b 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreatePersonRequest : IBackedModel, IParsable + public partial class DataInCreatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreatePersonRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The lid property public string? Lid { @@ -32,13 +28,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest? Relationships { @@ -46,27 +35,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreatePersonRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest(); @@ -76,15 +50,13 @@ public DataInCreatePersonRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 2dc289e237..705018cfa6 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateTagRequest : IBackedModel, IParsable + public partial class DataInCreateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreateTagRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The lid property public string? Lid { @@ -32,13 +28,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest? Relationships { @@ -46,27 +35,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateTagRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest(); @@ -76,15 +50,13 @@ public DataInCreateTagRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 470da8bfd4..e1493f92ca 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateTodoItemRequest : IBackedModel, IParsable + public partial class DataInCreateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreateTodoItemRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The lid property public string? Lid { @@ -32,13 +28,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest? Relationships { @@ -46,27 +35,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateTodoItemRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest(); @@ -76,15 +50,13 @@ public DataInCreateTodoItemRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/PersonDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInPersonResponse.cs similarity index 80% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInPersonResponse.cs index 4b4a6739c5..102783642e 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInPersonResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PersonDataInResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInPersonResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAttributesInResponse? Attributes + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonRelationshipsInResponse? Relationships + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTagResponse.cs similarity index 80% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTagResponse.cs index 8c287c4c51..d32e8dd080 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTagResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TagDataInResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInTagResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagAttributesInResponse? Attributes + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagRelationshipsInResponse? Relationships + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagDataInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTodoItemResponse.cs similarity index 80% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTodoItemResponse.cs index 87a0224c2c..abe7290e36 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTodoItemResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TodoItemDataInResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInTodoItemResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAttributesInResponse? Attributes + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemRelationshipsInResponse? Relationships + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemDataInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs index 7147a98aba..4cc76e39b0 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdatePersonRequest : IBackedModel, IParsable + public partial class DataInUpdatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdatePersonRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -39,13 +35,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest? Relationships { @@ -53,27 +42,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdatePersonRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest(); @@ -83,16 +57,14 @@ public DataInUpdatePersonRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -100,15 +72,14 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 60e258c75f..67e8f056d0 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateTagRequest : IBackedModel, IParsable + public partial class DataInUpdateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateTagRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -39,13 +35,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest? Relationships { @@ -53,27 +42,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateTagRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest(); @@ -83,16 +57,14 @@ public DataInUpdateTagRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -100,15 +72,14 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 6febc70e92..f3500e1884 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateTodoItemRequest : IBackedModel, IParsable + public partial class DataInUpdateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateTodoItemRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -39,13 +35,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest? Relationships { @@ -53,27 +42,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateTodoItemRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest(); @@ -83,16 +57,14 @@ public DataInUpdateTodoItemRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -100,15 +72,14 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/IdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..a997c6e0bf --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonSecondaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableSecondaryPersonResponseDocument.cs similarity index 81% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonSecondaryResponseDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableSecondaryPersonResponseDocument.cs index 031d30c5bb..f3a621d45c 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonSecondaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableSecondaryPersonResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NullablePersonSecondaryResponseDocument : IBackedModel, IParsable + public partial class NullableSecondaryPersonResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse? Data + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class NullablePersonSecondaryResponseDocument : IBackedModel, IPa } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public NullablePersonSecondaryResponseDocument() + public NullableSecondaryPersonResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public NullablePersonSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.NullablePersonSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableSecondaryPersonResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.NullablePersonSecondaryResponseDocument(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableSecondaryPersonResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs index 54a3ee85f6..3b92c217c9 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class PersonCollectionResponseDocument : IBackedModel, IParsable public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs index 2f770cae93..45aadb8951 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PersonIdentifierInRequest : IBackedModel, IParsable + public partial class PersonIdentifierInRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public PersonIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest(); @@ -69,14 +43,12 @@ public PersonIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/PersonPrimaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryPersonResponseDocument.cs similarity index 81% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonPrimaryResponseDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryPersonResponseDocument.cs index a5407d0327..769819ff5d 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonPrimaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryPersonResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PersonPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryPersonResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse? Data + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class PersonPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public PersonPrimaryResponseDocument() + public PrimaryPersonResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public PersonPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonPrimaryResponseDocument(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagPrimaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTagResponseDocument.cs similarity index 81% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagPrimaryResponseDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTagResponseDocument.cs index b7b6ebea82..56faf94dec 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagPrimaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTagResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TagPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryTagResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagDataInResponse? Data + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class TagPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public TagPrimaryResponseDocument() + public PrimaryTagResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public TagPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagPrimaryResponseDocument(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPrimaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTodoItemResponseDocument.cs similarity index 81% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPrimaryResponseDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTodoItemResponseDocument.cs index d2cc0a2ab7..2aefc28121 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPrimaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTodoItemResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TodoItemPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryTodoItemResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemDataInResponse? Data + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class TodoItemPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public TodoItemPrimaryResponseDocument() + public PrimaryTodoItemResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public TodoItemPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPrimaryResponseDocument(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreatePersonRequest.cs index 9f374aae95..a7c1dc9803 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreatePersonRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreatePersonRequest : IBackedModel, IParsable + public partial class RelationshipsInCreatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { /// The assignedTodoItems property @@ -22,9 +21,6 @@ public partial class RelationshipsInCreatePersonRequest : IBackedModel, IParsabl set { BackingStore?.Set("assignedTodoItems", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ownedTodoItems property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? OwnedTodoItems { @@ -32,20 +28,12 @@ public partial class RelationshipsInCreatePersonRequest : IBackedModel, IParsabl set { BackingStore?.Set("ownedTodoItems", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreatePersonRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest(); @@ -55,9 +43,9 @@ public RelationshipsInCreatePersonRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "assignedTodoItems", n => { AssignedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, { "ownedTodoItems", n => { OwnedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("assignedTodoItems", AssignedTodoItems); writer.WriteObjectValue("ownedTodoItems", OwnedTodoItems); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..c9c8d2247d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTagRequest.cs index 5ee63a47b5..6faaa2cb56 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTagRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateTagRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The todoItems property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? TodoItems { @@ -25,20 +21,12 @@ public partial class RelationshipsInCreateTagRequest : IBackedModel, IParsable set { BackingStore?.Set("todoItems", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateTagRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest(); @@ -48,9 +36,9 @@ public RelationshipsInCreateTagRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "todoItems", n => { TodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("todoItems", TodoItems); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTodoItemRequest.cs index 7efda81669..0a8e32873b 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTodoItemRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateTodoItemRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { /// The assignee property @@ -22,9 +21,6 @@ public partial class RelationshipsInCreateTodoItemRequest : IBackedModel, IParsa set { BackingStore?.Set("assignee", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The owner property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest? Owner { @@ -39,20 +35,12 @@ public partial class RelationshipsInCreateTodoItemRequest : IBackedModel, IParsa set { BackingStore?.Set("tags", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateTodoItemRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest(); @@ -62,9 +50,9 @@ public RelationshipsInCreateTodoItemRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "assignee", n => { Assignee = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest.CreateFromDiscriminatorValue); } }, { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("assignee", Assignee); writer.WriteObjectValue("owner", Owner); writer.WriteObjectValue("tags", Tags); diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonRelationshipsInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInPersonResponse.cs similarity index 74% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonRelationshipsInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInPersonResponse.cs index a6c39fb71c..700c9b301a 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonRelationshipsInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInPersonResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PersonRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInPersonResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { /// The assignedTodoItems property @@ -22,9 +21,6 @@ public partial class PersonRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("assignedTodoItems", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ownedTodoItems property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse? OwnedTodoItems { @@ -32,32 +28,24 @@ public partial class PersonRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("ownedTodoItems", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public PersonRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonRelationshipsInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "assignedTodoItems", n => { AssignedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse.CreateFromDiscriminatorValue); } }, { "ownedTodoItems", n => { OwnedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("assignedTodoItems", AssignedTodoItems); writer.WriteObjectValue("ownedTodoItems", OwnedTodoItems); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..037808aa1f --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagRelationshipsInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTagResponse.cs similarity index 68% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagRelationshipsInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTagResponse.cs index e18f6db294..eb854e08d8 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagRelationshipsInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTagResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TagRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInTagResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The todoItems property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse? TodoItems { @@ -25,32 +21,24 @@ public partial class TagRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("todoItems", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public TagRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagRelationshipsInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "todoItems", n => { TodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("todoItems", TodoItems); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemRelationshipsInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTodoItemResponse.cs similarity index 77% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemRelationshipsInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTodoItemResponse.cs index 6b375c2669..56e9402ada 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemRelationshipsInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTodoItemResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TodoItemRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInTodoItemResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { /// The assignee property @@ -22,9 +21,6 @@ public partial class TodoItemRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("assignee", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The owner property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInResponse? Owner { @@ -39,32 +35,24 @@ public partial class TodoItemRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("tags", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public TodoItemRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemRelationshipsInResponse(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "assignee", n => { Assignee = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInResponse.CreateFromDiscriminatorValue); } }, { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInResponse.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("assignee", Assignee); writer.WriteObjectValue("owner", Owner); writer.WriteObjectValue("tags", Tags); diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdatePersonRequest.cs index e70db7671e..ee9185a310 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdatePersonRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdatePersonRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The assignedTodoItems property @@ -22,9 +21,6 @@ public partial class RelationshipsInUpdatePersonRequest : IBackedModel, IParsabl set { BackingStore?.Set("assignedTodoItems", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ownedTodoItems property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? OwnedTodoItems { @@ -32,20 +28,12 @@ public partial class RelationshipsInUpdatePersonRequest : IBackedModel, IParsabl set { BackingStore?.Set("ownedTodoItems", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdatePersonRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest(); @@ -55,9 +43,9 @@ public RelationshipsInUpdatePersonRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "assignedTodoItems", n => { AssignedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, { "ownedTodoItems", n => { OwnedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("assignedTodoItems", AssignedTodoItems); writer.WriteObjectValue("ownedTodoItems", OwnedTodoItems); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..13621d8e84 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTagRequest.cs index 8c2191db85..87a99d727d 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTagRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateTagRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The todoItems property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? TodoItems { @@ -25,20 +21,12 @@ public partial class RelationshipsInUpdateTagRequest : IBackedModel, IParsable set { BackingStore?.Set("todoItems", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateTagRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest(); @@ -48,9 +36,9 @@ public RelationshipsInUpdateTagRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "todoItems", n => { TodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("todoItems", TodoItems); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTodoItemRequest.cs index 7653f18c30..0503466973 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTodoItemRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateTodoItemRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The assignee property @@ -22,9 +21,6 @@ public partial class RelationshipsInUpdateTodoItemRequest : IBackedModel, IParsa set { BackingStore?.Set("assignee", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The owner property public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest? Owner { @@ -39,20 +35,12 @@ public partial class RelationshipsInUpdateTodoItemRequest : IBackedModel, IParsa set { BackingStore?.Set("tags", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateTodoItemRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest(); @@ -62,9 +50,9 @@ public RelationshipsInUpdateTodoItemRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "assignee", n => { Assignee = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest.CreateFromDiscriminatorValue); } }, { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("assignee", Assignee); writer.WriteObjectValue("owner", Owner); writer.WriteObjectValue("tags", Tags); diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInCreateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..091cfb0a93 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInResponse.cs similarity index 88% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInResponse.cs index 3e5bc015da..b5417c7dd0 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInResponse.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class ResourceInResponse : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public ResourceInResponse() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,18 +43,18 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse(), - "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagDataInResponse(), - "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemDataInResponse(), - _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse(), + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse(), }; } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInUpdateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..f59c44514e --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonSecondaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/SecondaryPersonResponseDocument.cs similarity index 81% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonSecondaryResponseDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/SecondaryPersonResponseDocument.cs index 2b241b2c09..2ca28ffaba 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonSecondaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/SecondaryPersonResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PersonSecondaryResponseDocument : IBackedModel, IParsable + public partial class SecondaryPersonResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse? Data + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class PersonSecondaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public PersonSecondaryResponseDocument() + public SecondaryPersonResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public PersonSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.SecondaryPersonResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonSecondaryResponseDocument(); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.SecondaryPersonResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs index 1be6fb525c..8a8212126b 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class TagCollectionResponseDocument : IBackedModel, IParsable public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs index 88ac263a84..b1fa1ae9ea 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TagIdentifierInRequest : IBackedModel, IParsable + public partial class TagIdentifierInRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public TagIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest(); @@ -69,14 +43,12 @@ public TagIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/TodoItemCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs index aad1e78afc..39924b4e0c 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class TodoItemCollectionResponseDocument : IBackedModel, IParsabl public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs index 2e55c9a1fb..625c96abfe 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaClientExample.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TodoItemIdentifierInRequest : IBackedModel, IParsable + public partial class TodoItemIdentifierInRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public TodoItemIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest(); @@ -69,14 +43,12 @@ public TodoItemIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/PeopleMessageFormatter.cs b/src/Examples/OpenApiKiotaClientExample/PeopleMessageFormatter.cs index 83b3d6264f..db22ae6231 100644 --- a/src/Examples/OpenApiKiotaClientExample/PeopleMessageFormatter.cs +++ b/src/Examples/OpenApiKiotaClientExample/PeopleMessageFormatter.cs @@ -26,7 +26,7 @@ private static string WritePeople(PersonCollectionResponseDocument? peopleRespon var builder = new StringBuilder(); builder.AppendLine($"Found {peopleResponse.Data!.Count} people:"); - foreach (PersonDataInResponse person in peopleResponse.Data) + foreach (DataInPersonResponse person in peopleResponse.Data) { WritePerson(person, peopleResponse.Included ?? [], builder); } @@ -34,7 +34,7 @@ private static string WritePeople(PersonCollectionResponseDocument? peopleRespon return builder.ToString(); } - private static void WritePerson(PersonDataInResponse person, List includes, StringBuilder builder) + private static void WritePerson(DataInPersonResponse person, List includes, StringBuilder builder) { List assignedTodoItems = person.Relationships?.AssignedTodoItems?.Data ?? []; @@ -42,11 +42,11 @@ private static void WritePerson(PersonDataInResponse person, List todoItemIdentifiers, List includes, StringBuilder builder) + private static void WriteRelatedTodoItems(List todoItemIdentifiers, List includes, StringBuilder builder) { foreach (TodoItemIdentifierInResponse todoItemIdentifier in todoItemIdentifiers) { - TodoItemDataInResponse includedTodoItem = includes.OfType().Single(include => include.Id == todoItemIdentifier.Id); + DataInTodoItemResponse includedTodoItem = includes.OfType().Single(include => include.Id == todoItemIdentifier.Id); List tags = includedTodoItem.Relationships?.Tags?.Data ?? []; builder.AppendLine($" TodoItem {includedTodoItem.Id}: {includedTodoItem.Attributes?.Description} with {tags.Count} tags:"); @@ -54,11 +54,11 @@ private static void WriteRelatedTodoItems(List tod } } - private static void WriteRelatedTags(List tagIdentifiers, List includes, StringBuilder builder) + private static void WriteRelatedTags(List tagIdentifiers, List includes, StringBuilder builder) { foreach (TagIdentifierInResponse tagIdentifier in tagIdentifiers) { - TagDataInResponse includedTag = includes.OfType().Single(include => include.Id == tagIdentifier.Id); + DataInTagResponse includedTag = includes.OfType().Single(include => include.Id == tagIdentifier.Id); builder.AppendLine($" Tag {includedTag.Id}: {includedTag.Attributes?.Name}"); } } diff --git a/src/Examples/OpenApiKiotaClientExample/Worker.cs b/src/Examples/OpenApiKiotaClientExample/Worker.cs index f401ee8d24..56c6cd6b0d 100644 --- a/src/Examples/OpenApiKiotaClientExample/Worker.cs +++ b/src/Examples/OpenApiKiotaClientExample/Worker.cs @@ -89,7 +89,7 @@ private async Task UpdatePersonAsync(CancellationToken cancellationToken) { Data = new DataInUpdatePersonRequest { - Type = PersonResourceType.People, + Type = ResourceType.People, Id = "1", Attributes = new AttributesInUpdatePersonRequest { @@ -114,7 +114,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke Op = AddOperationCode.Add, Data = new DataInCreateTagRequest { - Type = TagResourceType.Tags, + Type = ResourceType.Tags, Lid = "new-tag", Attributes = new AttributesInCreateTagRequest { @@ -127,7 +127,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke Op = AddOperationCode.Add, Data = new DataInCreatePersonRequest { - Type = PersonResourceType.People, + Type = ResourceType.People, Lid = "new-person", Attributes = new AttributesInCreatePersonRequest { @@ -141,7 +141,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke Op = UpdateOperationCode.Update, Data = new DataInUpdatePersonRequest { - Type = PersonResourceType.People, + Type = ResourceType.People, Lid = "new-person", Attributes = new AttributesInUpdatePersonRequest { @@ -155,7 +155,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke Op = AddOperationCode.Add, Data = new DataInCreateTodoItemRequest { - Type = TodoItemResourceType.TodoItems, + Type = ResourceType.TodoItems, Lid = "new-todo-item", Attributes = new AttributesInCreateTodoItemRequest { @@ -168,7 +168,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke { Data = new PersonIdentifierInRequest { - Type = PersonResourceType.People, + Type = ResourceType.People, Lid = "new-person" } }, @@ -178,7 +178,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke [ new TagIdentifierInRequest { - Type = TagResourceType.Tags, + Type = ResourceType.Tags, Lid = "new-tag" } ] @@ -197,7 +197,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke }, Data = new PersonIdentifierInRequest { - Type = PersonResourceType.People, + Type = ResourceType.People, Lid = "new-person" } } @@ -206,7 +206,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke OperationsResponseDocument? operationsResponse = await _apiClient.Api.Operations.PostAsync(operationsRequest, cancellationToken: cancellationToken); - var newTodoItem = (TodoItemDataInResponse)operationsResponse!.AtomicResults!.ElementAt(3).Data!; + var newTodoItem = (DataInTodoItemResponse)operationsResponse!.AtomicResults!.ElementAt(3).Data!; Console.WriteLine($"Created todo-item with ID {newTodoItem.Id}: {newTodoItem.Attributes!.Description}."); } } diff --git a/src/Examples/OpenApiNSwagClientExample/PeopleMessageFormatter.cs b/src/Examples/OpenApiNSwagClientExample/PeopleMessageFormatter.cs index 81f0de9a9a..0a870d7682 100644 --- a/src/Examples/OpenApiNSwagClientExample/PeopleMessageFormatter.cs +++ b/src/Examples/OpenApiNSwagClientExample/PeopleMessageFormatter.cs @@ -26,7 +26,7 @@ private static string WritePeople(ApiResponse var builder = new StringBuilder(); builder.AppendLine($"Found {peopleResponse.Result.Data.Count} people:"); - foreach (PersonDataInResponse person in peopleResponse.Result.Data) + foreach (DataInPersonResponse person in peopleResponse.Result.Data) { WritePerson(person, peopleResponse.Result.Included ?? [], builder); } @@ -34,7 +34,7 @@ private static string WritePeople(ApiResponse return builder.ToString(); } - private static void WritePerson(PersonDataInResponse person, ICollection includes, StringBuilder builder) + private static void WritePerson(DataInPersonResponse person, ICollection includes, StringBuilder builder) { ICollection assignedTodoItems = person.Relationships?.AssignedTodoItems?.Data ?? []; @@ -42,12 +42,12 @@ private static void WritePerson(PersonDataInResponse person, ICollection todoItemIdentifiers, ICollection includes, + private static void WriteRelatedTodoItems(IEnumerable todoItemIdentifiers, ICollection includes, StringBuilder builder) { foreach (TodoItemIdentifierInResponse todoItemIdentifier in todoItemIdentifiers) { - TodoItemDataInResponse includedTodoItem = includes.OfType().Single(include => include.Id == todoItemIdentifier.Id); + DataInTodoItemResponse includedTodoItem = includes.OfType().Single(include => include.Id == todoItemIdentifier.Id); ICollection tags = includedTodoItem.Relationships?.Tags?.Data ?? []; builder.AppendLine($" TodoItem {includedTodoItem.Id}: {includedTodoItem.Attributes?.Description} with {tags.Count} tags:"); @@ -55,11 +55,11 @@ private static void WriteRelatedTodoItems(IEnumerable tagIdentifiers, ICollection includes, StringBuilder builder) + private static void WriteRelatedTags(IEnumerable tagIdentifiers, ICollection includes, StringBuilder builder) { foreach (TagIdentifierInResponse tagIdentifier in tagIdentifiers) { - TagDataInResponse includedTag = includes.OfType().Single(include => include.Id == tagIdentifier.Id); + DataInTagResponse includedTag = includes.OfType().Single(include => include.Id == tagIdentifier.Id); builder.AppendLine($" Tag {includedTag.Id}: {includedTag.Attributes?.Name}"); } } diff --git a/src/Examples/OpenApiNSwagClientExample/Worker.cs b/src/Examples/OpenApiNSwagClientExample/Worker.cs index 3360eb7a8a..7727c88a15 100644 --- a/src/Examples/OpenApiNSwagClientExample/Worker.cs +++ b/src/Examples/OpenApiNSwagClientExample/Worker.cs @@ -165,7 +165,7 @@ private async Task SendOperationsRequestAsync(CancellationToken cancellationToke ApiResponse operationsResponse = await _apiClient.PostOperationsAsync(operationsRequest, cancellationToken); - var newTodoItem = (TodoItemDataInResponse)operationsResponse.Result.Atomic_results.ElementAt(3).Data!; + var newTodoItem = (DataInTodoItemResponse)operationsResponse.Result.Atomic_results.ElementAt(3).Data!; Console.WriteLine($"Created todo-item with ID {newTodoItem.Id}: {newTodoItem.Attributes!.Description}."); } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureMvcOptions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureMvcOptions.cs index 9409e7824c..e1e04a2464 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureMvcOptions.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureMvcOptions.cs @@ -1,3 +1,4 @@ +using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Middleware; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; @@ -10,25 +11,32 @@ internal sealed class ConfigureMvcOptions : IConfigureOptions private readonly IJsonApiRoutingConvention _jsonApiRoutingConvention; private readonly OpenApiEndpointConvention _openApiEndpointConvention; private readonly JsonApiRequestFormatMetadataProvider _jsonApiRequestFormatMetadataProvider; + private readonly IJsonApiOptions _jsonApiOptions; public ConfigureMvcOptions(IJsonApiRoutingConvention jsonApiRoutingConvention, OpenApiEndpointConvention openApiEndpointConvention, - JsonApiRequestFormatMetadataProvider jsonApiRequestFormatMetadataProvider) + JsonApiRequestFormatMetadataProvider jsonApiRequestFormatMetadataProvider, IJsonApiOptions jsonApiOptions) { ArgumentNullException.ThrowIfNull(jsonApiRoutingConvention); ArgumentNullException.ThrowIfNull(openApiEndpointConvention); ArgumentNullException.ThrowIfNull(jsonApiRequestFormatMetadataProvider); + ArgumentNullException.ThrowIfNull(jsonApiOptions); _jsonApiRoutingConvention = jsonApiRoutingConvention; _openApiEndpointConvention = openApiEndpointConvention; _jsonApiRequestFormatMetadataProvider = jsonApiRequestFormatMetadataProvider; + _jsonApiOptions = jsonApiOptions; } public void Configure(MvcOptions options) { + ArgumentNullException.ThrowIfNull(options); + AddSwashbuckleCliCompatibility(options); options.InputFormatters.Add(_jsonApiRequestFormatMetadataProvider); options.Conventions.Add(_openApiEndpointConvention); + + ((JsonApiOptions)_jsonApiOptions).IncludeExtensions(OpenApiMediaTypeExtension.OpenApi, OpenApiMediaTypeExtension.RelaxedOpenApi); } private void AddSwashbuckleCliCompatibility(MvcOptions options) diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs index 00e24965b5..f3fb5198ca 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs @@ -4,6 +4,7 @@ using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using JsonApiDotNetCore.Resources; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -13,11 +14,19 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle; internal sealed class ConfigureSwaggerGenOptions : IConfigureOptions { + private static readonly Dictionary BaseToDerivedSchemaTypes = new() + { + [typeof(IdentifierInRequest)] = typeof(IdentifierInRequest<>), + [typeof(ResourceInCreateRequest)] = typeof(DataInCreateRequest<>), + [typeof(ResourceInUpdateRequest)] = typeof(DataInUpdateRequest<>), + [typeof(ResourceInResponse)] = typeof(DataInResponse<>) + }; + private static readonly Type[] AtomicOperationDerivedSchemaTypes = [ - typeof(CreateResourceOperation<>), - typeof(UpdateResourceOperation<>), - typeof(DeleteResourceOperation<>), + typeof(CreateOperation<>), + typeof(UpdateOperation<>), + typeof(DeleteOperation<>), typeof(UpdateToOneRelationshipOperation<>), typeof(UpdateToManyRelationshipOperation<>), typeof(AddToRelationshipOperation<>), @@ -63,14 +72,15 @@ public void Configure(SwaggerGenOptions options) options.DocumentFilter(); options.DocumentFilter(); options.DocumentFilter(); + options.DocumentFilter(); options.DocumentFilter(); } private List SelectDerivedTypes(Type baseType) { - if (baseType == typeof(ResourceData)) + if (BaseToDerivedSchemaTypes.TryGetValue(baseType, out Type? schemaOpenType)) { - return GetConstructedTypesForResourceData(); + return GetConstructedTypesFromResourceGraph(schemaOpenType); } if (baseType == typeof(AtomicOperation)) @@ -78,20 +88,30 @@ private List SelectDerivedTypes(Type baseType) return GetConstructedTypesForAtomicOperation(); } + if (baseType.IsAssignableTo(typeof(IIdentifiable))) + { + ResourceType? resourceType = _resourceGraph.FindResourceType(baseType); + + if (resourceType != null && resourceType.IsPartOfTypeHierarchy()) + { + return GetResourceDerivedTypes(resourceType); + } + } + return []; } - private List GetConstructedTypesForResourceData() + private List GetConstructedTypesFromResourceGraph(Type schemaOpenType) { - List derivedTypes = []; + List constructedTypes = []; foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes()) { - Type constructedType = typeof(ResourceDataInResponse<>).MakeGenericType(resourceType.ClrType); - derivedTypes.Add(constructedType); + Type constructedType = schemaOpenType.MakeGenericType(resourceType.ClrType); + constructedTypes.Add(constructedType); } - return derivedTypes; + return constructedTypes; } private List GetConstructedTypesForAtomicOperation() @@ -106,6 +126,22 @@ private List GetConstructedTypesForAtomicOperation() return derivedTypes; } + private static List GetResourceDerivedTypes(ResourceType baseType) + { + List clrTypes = []; + IncludeDerivedTypes(baseType, clrTypes); + return clrTypes; + } + + private static void IncludeDerivedTypes(ResourceType baseType, List clrTypes) + { + foreach (ResourceType derivedType in baseType.DirectlyDerivedTypes) + { + clrTypes.Add(derivedType.ClrType); + IncludeDerivedTypes(derivedType, clrTypes); + } + } + private static List GetOpenApiOperationTags(ApiDescription description, IControllerResourceMapping controllerResourceMapping) { MethodInfo actionMethod = description.ActionDescriptor.GetActionMethod(); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IJsonApiRequestAccessor.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IJsonApiRequestAccessor.cs new file mode 100644 index 0000000000..ab9445b39e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IJsonApiRequestAccessor.cs @@ -0,0 +1,14 @@ +using JsonApiDotNetCore.Middleware; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Provides access to the current , if one is available. +/// +internal interface IJsonApiRequestAccessor +{ + /// + /// Gets the current . Returns null if there is no active request. + /// + IJsonApiRequest? Current { get; } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IncludeDependencyScanner.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IncludeDependencyScanner.cs index f63e25ecb6..97f86e2834 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IncludeDependencyScanner.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IncludeDependencyScanner.cs @@ -5,28 +5,49 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle; internal sealed class IncludeDependencyScanner { + public static IncludeDependencyScanner Instance { get; } = new(); + + private IncludeDependencyScanner() + { + } + /// - /// Returns all related resource types that are reachable from the specified resource type. May include itself. + /// Returns all related resource types that are reachable from the specified resource type. Does not include itself. /// public IReadOnlySet GetReachableRelatedTypes(ResourceType resourceType) { ArgumentNullException.ThrowIfNull(resourceType); HashSet resourceTypesFound = []; - AddTypesFromRelationships(resourceType.Relationships, resourceTypesFound); + + IncludeResourceType(resourceType, resourceTypesFound); + resourceTypesFound.Remove(resourceType); + return resourceTypesFound; } - private static void AddTypesFromRelationships(IEnumerable relationships, ISet resourceTypesFound) + private static void IncludeResourceType(ResourceType resourceType, ISet resourceTypesFound) { - foreach (RelationshipAttribute relationship in relationships) + if (resourceTypesFound.Add(resourceType)) { - ResourceType resourceType = relationship.RightType; + IncludeDerivedTypes(resourceType, resourceTypesFound); + IncludeRelatedTypes(resourceType, resourceTypesFound); + } + } - if (resourceTypesFound.Add(resourceType)) - { - AddTypesFromRelationships(resourceType.Relationships, resourceTypesFound); - } + private static void IncludeDerivedTypes(ResourceType resourceType, ISet resourceTypesFound) + { + foreach (ResourceType derivedType in resourceType.DirectlyDerivedTypes) + { + IncludeResourceType(derivedType, resourceTypesFound); + } + } + + private static void IncludeRelatedTypes(ResourceType resourceType, ISet resourceTypesFound) + { + foreach (RelationshipAttribute relationship in resourceType.Relationships) + { + IncludeResourceType(relationship.RightType, resourceTypesFound); } } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataProvider.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataProvider.cs index 7d69df49a4..b14f5e28ac 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataProvider.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataProvider.cs @@ -68,14 +68,14 @@ public JsonApiEndpointMetadataContainer Get(MethodInfo controllerAction) private static PrimaryRequestMetadata GetPostResourceRequestMetadata(Type resourceClrType) { - Type documentType = typeof(CreateResourceRequestDocument<>).MakeGenericType(resourceClrType); + Type documentType = typeof(CreateRequestDocument<>).MakeGenericType(resourceClrType); return new PrimaryRequestMetadata(documentType); } private static PrimaryRequestMetadata GetPatchResourceRequestMetadata(Type resourceClrType) { - Type documentType = typeof(UpdateResourceRequestDocument<>).MakeGenericType(resourceClrType); + Type documentType = typeof(UpdateRequestDocument<>).MakeGenericType(resourceClrType); return new PrimaryRequestMetadata(documentType); } @@ -104,7 +104,7 @@ private RelationshipRequestMetadata GetRelationshipRequestMetadata(IEnumerable) : typeof(PrimaryResourceResponseDocument<>); + Type documentOpenType = endpointReturnsCollection ? typeof(CollectionResponseDocument<>) : typeof(PrimaryResponseDocument<>); Type documentType = documentOpenType.MakeGenericType(resourceClrType); return new PrimaryResponseMetadata(documentType); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryDocumentTypeFactory.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryDocumentTypeFactory.cs index ee155142dc..7550d59ab3 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryDocumentTypeFactory.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryDocumentTypeFactory.cs @@ -6,14 +6,14 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; internal sealed class NonPrimaryDocumentTypeFactory { - private static readonly DocumentOpenTypes SecondaryResponseDocumentOpenTypes = new(typeof(ResourceCollectionResponseDocument<>), - typeof(NullableSecondaryResourceResponseDocument<>), typeof(SecondaryResourceResponseDocument<>)); + private static readonly DocumentOpenTypes SecondaryResponseDocumentOpenTypes = new(typeof(CollectionResponseDocument<>), + typeof(NullableSecondaryResponseDocument<>), typeof(SecondaryResponseDocument<>)); - private static readonly DocumentOpenTypes RelationshipRequestDocumentOpenTypes = new(typeof(ToManyRelationshipInRequest<>), - typeof(NullableToOneRelationshipInRequest<>), typeof(ToOneRelationshipInRequest<>)); + private static readonly DocumentOpenTypes RelationshipRequestDocumentOpenTypes = new(typeof(ToManyInRequest<>), + typeof(NullableToOneInRequest<>), typeof(ToOneInRequest<>)); - private static readonly DocumentOpenTypes RelationshipResponseDocumentOpenTypes = new(typeof(ResourceIdentifierCollectionResponseDocument<>), - typeof(NullableResourceIdentifierResponseDocument<>), typeof(ResourceIdentifierResponseDocument<>)); + private static readonly DocumentOpenTypes RelationshipResponseDocumentOpenTypes = new(typeof(IdentifierCollectionResponseDocument<>), + typeof(NullableIdentifierResponseDocument<>), typeof(IdentifierResponseDocument<>)); private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipTypeFactory.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipTypeFactory.cs index 0841645f93..be5a6fd30c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipTypeFactory.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipTypeFactory.cs @@ -32,10 +32,10 @@ public Type GetForResponse(RelationshipAttribute relationship) // @formatter:nested_ternary_style expanded Type relationshipDataOpenType = relationship is HasManyAttribute - ? typeof(ToManyRelationshipInResponse<>) + ? typeof(ToManyInResponse<>) : _resourceFieldValidationMetadataProvider.IsNullable(relationship) - ? typeof(NullableToOneRelationshipInResponse<>) - : typeof(ToOneRelationshipInResponse<>); + ? typeof(NullableToOneInResponse<>) + : typeof(ToOneInResponse<>); // @formatter:nested_ternary_style restore diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AddToRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AddToRelationshipOperation.cs index 0170916b52..bf461fe41a 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AddToRelationshipOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AddToRelationshipOperation.cs @@ -20,5 +20,5 @@ internal sealed class AddToRelationshipOperation : AtomicOperation [Required] [JsonPropertyName("data")] - public ICollection> Data { get; set; } = null!; + public ICollection> Data { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs index 9e12fca162..f4dec21cbf 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; internal sealed class AtomicResult : IHasMeta { [JsonPropertyName("data")] - public ResourceData Data { get; set; } = null!; + public ResourceInResponse Data { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateResourceOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateOperation.cs similarity index 77% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateResourceOperation.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateOperation.cs index a4e3f51e82..266712e666 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateResourceOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateOperation.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class CreateResourceOperation : AtomicOperation +internal sealed class CreateOperation : AtomicOperation where TResource : IIdentifiable { [Required] @@ -16,5 +16,5 @@ internal sealed class CreateResourceOperation : AtomicOperation [Required] [JsonPropertyName("data")] - public DataInCreateResourceRequest Data { get; set; } = null!; + public DataInCreateRequest Data { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteResourceOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteOperation.cs similarity index 77% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteResourceOperation.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteOperation.cs index d50cc5cf9f..838b4400dd 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteResourceOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteOperation.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class DeleteResourceOperation : AtomicOperation +internal sealed class DeleteOperation : AtomicOperation where TResource : IIdentifiable { [Required] @@ -16,5 +16,5 @@ internal sealed class DeleteResourceOperation : AtomicOperation [Required] [JsonPropertyName("ref")] - public ResourceIdentifierInRequest Ref { get; set; } = null!; + public IdentifierInRequest Ref { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/RemoveFromRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/RemoveFromRelationshipOperation.cs index b8dc0ed3e5..eafe36028e 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/RemoveFromRelationshipOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/RemoveFromRelationshipOperation.cs @@ -20,5 +20,5 @@ internal sealed class RemoveFromRelationshipOperation : AtomicOperati [Required] [JsonPropertyName("data")] - public ICollection> Data { get; set; } = null!; + public ICollection> Data { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateResourceOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateOperation.cs similarity index 70% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateResourceOperation.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateOperation.cs index e515887b36..cb576c3a4f 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateResourceOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateOperation.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class UpdateResourceOperation : AtomicOperation +internal sealed class UpdateOperation : AtomicOperation where TResource : IIdentifiable { [Required] @@ -15,9 +15,9 @@ internal sealed class UpdateResourceOperation : AtomicOperation public string Op { get; set; } = null!; [JsonPropertyName("ref")] - public ResourceIdentifierInRequest Ref { get; set; } = null!; + public IdentifierInRequest Ref { get; set; } = null!; [Required] [JsonPropertyName("data")] - public DataInUpdateResourceRequest Data { get; set; } = null!; + public DataInUpdateRequest Data { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToManyRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToManyRelationshipOperation.cs index 60cc6d7645..2725b3dd9f 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToManyRelationshipOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToManyRelationshipOperation.cs @@ -20,5 +20,5 @@ internal sealed class UpdateToManyRelationshipOperation : AtomicOpera [Required] [JsonPropertyName("data")] - public ICollection> Data { get; set; } = null!; + public ICollection> Data { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToOneRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToOneRelationshipOperation.cs index 3ebb775df0..71c6528605 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToOneRelationshipOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToOneRelationshipOperation.cs @@ -21,5 +21,5 @@ internal sealed class UpdateToOneRelationshipOperation : AtomicOperat [Required] [JsonPropertyName("data")] // Nullability of this property is determined based on the nullability of the to-one relationship. - public ResourceIdentifierInRequest? Data { get; set; } + public IdentifierInRequest? Data { get; set; } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CollectionResponseDocument.cs similarity index 78% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CollectionResponseDocument.cs index 9368e4dabe..bfb0131f07 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CollectionResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceCollectionResponseDocument : IHasMeta +internal sealed class CollectionResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] @@ -20,10 +20,10 @@ internal sealed class ResourceCollectionResponseDocument : IHasMeta [Required] [JsonPropertyName("data")] - public ICollection> Data { get; set; } = null!; + public ICollection> Data { get; set; } = null!; [JsonPropertyName("included")] - public IList Included { get; set; } = null!; + public IList Included { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateResourceRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateRequestDocument.cs similarity index 77% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateResourceRequestDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateRequestDocument.cs index bc5fff36db..388d659398 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateResourceRequestDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateRequestDocument.cs @@ -7,12 +7,12 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class UpdateResourceRequestDocument : IHasMeta +internal sealed class CreateRequestDocument : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] - public DataInUpdateResourceRequest Data { get; set; } = null!; + public DataInCreateRequest Data { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierCollectionResponseDocument.cs similarity index 81% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierCollectionResponseDocument.cs index 9b4affde1b..bf50821888 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierCollectionResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceIdentifierCollectionResponseDocument : IHasMeta +internal sealed class IdentifierCollectionResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] @@ -20,7 +20,7 @@ internal sealed class ResourceIdentifierCollectionResponseDocument : [Required] [JsonPropertyName("data")] - public ICollection> Data { get; set; } = null!; + public ICollection> Data { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierResponseDocument.cs similarity index 83% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierResponseDocument.cs index bcefbfe107..3c44955edc 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceIdentifierResponseDocument : IHasMeta +internal sealed class IdentifierResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] @@ -20,7 +20,7 @@ internal sealed class ResourceIdentifierResponseDocument : IHasMeta [Required] [JsonPropertyName("data")] - public ResourceIdentifierInResponse Data { get; set; } = null!; + public IdentifierInResponse Data { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableIdentifierResponseDocument.cs similarity index 87% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableIdentifierResponseDocument.cs index 9c44327b39..1386bec001 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableIdentifierResponseDocument.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 : IHasMeta +internal sealed class NullableIdentifierResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] @@ -22,7 +22,7 @@ internal sealed class NullableResourceIdentifierResponseDocument : IH [Required] [JsonPropertyName("data")] - public ResourceIdentifierInResponse? Data { get; set; } + public IdentifierInResponse? Data { get; set; } [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResponseDocument.cs similarity index 80% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResponseDocument.cs index d0aa1c5819..6d6d240a5b 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class SecondaryResourceResponseDocument : IHasMeta +internal sealed class NullableSecondaryResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] @@ -20,10 +20,10 @@ internal sealed class SecondaryResourceResponseDocument : IHasMeta [Required] [JsonPropertyName("data")] - public ResourceDataInResponse Data { get; set; } = null!; + public DataInResponse? Data { get; set; } [JsonPropertyName("included")] - public IList Included { get; set; } = null!; + public IList Included { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResponseDocument.cs similarity index 79% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResponseDocument.cs index 876c573129..1956fb8758 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class PrimaryResourceResponseDocument : IHasMeta +internal sealed class PrimaryResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] @@ -20,10 +20,10 @@ internal sealed class PrimaryResourceResponseDocument : IHasMeta [Required] [JsonPropertyName("data")] - public ResourceDataInResponse Data { get; set; } = null!; + public DataInResponse Data { get; set; } = null!; [JsonPropertyName("included")] - public IList Included { get; set; } = null!; + public IList Included { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResponseDocument.cs similarity index 79% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResponseDocument.cs index def465b2ef..6a90db36e1 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class NullableSecondaryResourceResponseDocument : IHasMeta +internal sealed class SecondaryResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] @@ -20,10 +20,10 @@ internal sealed class NullableSecondaryResourceResponseDocument : IHa [Required] [JsonPropertyName("data")] - public ResourceDataInResponse? Data { get; set; } + public DataInResponse Data { get; set; } = null!; [JsonPropertyName("included")] - public IList Included { get; set; } = null!; + public IList Included { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateResourceRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateRequestDocument.cs similarity index 77% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateResourceRequestDocument.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateRequestDocument.cs index 7d64cf6c96..cbeec3e86b 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateResourceRequestDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateRequestDocument.cs @@ -7,12 +7,12 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class CreateResourceRequestDocument : IHasMeta +internal sealed class UpdateRequestDocument : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] - public DataInCreateResourceRequest Data { get; set; } = null!; + public DataInUpdateRequest Data { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInRequest.cs similarity index 77% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInRequest.cs index 7a8cf67139..13f3290102 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInRequest.cs @@ -7,12 +7,12 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class NullableToOneRelationshipInRequest : IHasMeta +internal sealed class NullableToOneInRequest : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] - public ResourceIdentifierInRequest? Data { get; set; } + public IdentifierInRequest? 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/NullableToOneInResponse.cs similarity index 83% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInResponse.cs index 3e4088762b..29d13dd1c2 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class NullableToOneRelationshipInResponse : IHasMeta +internal sealed class NullableToOneInResponse : IHasMeta where TResource : IIdentifiable { // Non-required because the related controller may be unavailable when used in an include. @@ -16,7 +16,7 @@ internal sealed class NullableToOneRelationshipInResponse : IHasMeta // Non-required because related data may not be included in the response. [JsonPropertyName("data")] - public ResourceIdentifierInResponse? Data { get; set; } + public IdentifierInResponse? Data { get; set; } [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInRequest.cs similarity index 77% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInRequest.cs index c450ba6ab9..b80ab3a004 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInRequest.cs @@ -7,12 +7,12 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToOneRelationshipInRequest : IHasMeta +internal sealed class ToManyInRequest : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] - public ResourceIdentifierInRequest Data { get; set; } = null!; + public ICollection> 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/ToManyInResponse.cs similarity index 83% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInResponse.cs index 6d31f59c57..e60ab7f451 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToOneRelationshipInResponse : IHasMeta +internal sealed class ToManyInResponse : IHasMeta where TResource : IIdentifiable { // Non-required because the related controller may be unavailable when used in an include. @@ -16,7 +16,7 @@ internal sealed class ToOneRelationshipInResponse : IHasMeta // Non-required because related data may not be included in the response. [JsonPropertyName("data")] - public ResourceIdentifierInResponse Data { get; set; } = null!; + public ICollection> Data { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInRequest.cs similarity index 75% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInRequest.cs index 60ac184499..6404e84545 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInRequest.cs @@ -7,12 +7,12 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToManyRelationshipInRequest : IHasMeta +internal sealed class ToOneInRequest : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] - public ICollection> Data { get; set; } = null!; + public IdentifierInRequest 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/ToOneInResponse.cs similarity index 82% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInResponse.cs index 0fa82742a4..859a1de929 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToManyRelationshipInResponse : IHasMeta +internal sealed class ToOneInResponse : IHasMeta where TResource : IIdentifiable { // Non-required because the related controller may be unavailable when used in an include. @@ -16,7 +16,7 @@ internal sealed class ToManyRelationshipInResponse : IHasMeta // Non-required because related data may not be included in the response. [JsonPropertyName("data")] - public ICollection> Data { get; set; } = null!; + public IdentifierInResponse Data { get; set; } = null!; [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateResourceRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateRequest.cs similarity index 58% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateResourceRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateRequest.cs index 2ce3e95f83..0b8fddc0da 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateResourceRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateRequest.cs @@ -2,6 +2,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +internal abstract class AttributesInCreateRequest; + // ReSharper disable once UnusedTypeParameter -internal sealed class RelationshipsInCreateResourceRequest +internal sealed class AttributesInCreateRequest : AttributesInCreateRequest where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInResponse.cs index fc75dc17ea..d4b1bb728c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInResponse.cs @@ -2,6 +2,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +internal abstract class AttributesInResponse; + // ReSharper disable once UnusedTypeParameter -internal sealed class AttributesInResponse +internal sealed class AttributesInResponse : AttributesInResponse where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateResourceRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateRequest.cs similarity index 58% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateResourceRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateRequest.cs index 217fdd9674..d41bf18782 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateResourceRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateRequest.cs @@ -2,6 +2,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +internal abstract class AttributesInUpdateRequest; + // ReSharper disable once UnusedTypeParameter -internal sealed class AttributesInCreateResourceRequest +internal sealed class AttributesInUpdateRequest : AttributesInUpdateRequest where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateResourceRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateRequest.cs similarity index 69% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateResourceRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateRequest.cs index b54d9342d9..ac416a1614 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateResourceRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateRequest.cs @@ -6,7 +6,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class DataInUpdateResourceRequest : ResourceData +internal sealed class DataInCreateRequest : ResourceInCreateRequest where TResource : IIdentifiable { [MinLength(1)] @@ -18,8 +18,8 @@ internal sealed class DataInUpdateResourceRequest : ResourceData public string Lid { get; set; } = null!; [JsonPropertyName("attributes")] - public AttributesInUpdateResourceRequest Attributes { get; set; } = null!; + public AttributesInCreateRequest Attributes { get; set; } = null!; [JsonPropertyName("relationships")] - public RelationshipsInUpdateResourceRequest Relationships { get; set; } = null!; + public RelationshipsInCreateRequest Relationships { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInResponse.cs similarity index 92% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInResponse.cs index a4f9d40888..6015a3511d 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceDataInResponse : ResourceData +internal sealed class DataInResponse : ResourceInResponse where TResource : IIdentifiable { [Required] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateResourceRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateRequest.cs similarity index 69% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateResourceRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateRequest.cs index 9ba282b3d2..25167a5437 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateResourceRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateRequest.cs @@ -6,7 +6,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class DataInCreateResourceRequest : ResourceData +internal sealed class DataInUpdateRequest : ResourceInUpdateRequest where TResource : IIdentifiable { [MinLength(1)] @@ -18,8 +18,8 @@ internal sealed class DataInCreateResourceRequest : ResourceData public string Lid { get; set; } = null!; [JsonPropertyName("attributes")] - public AttributesInCreateResourceRequest Attributes { get; set; } = null!; + public AttributesInUpdateRequest Attributes { get; set; } = null!; [JsonPropertyName("relationships")] - public RelationshipsInCreateResourceRequest Relationships { get; set; } = null!; + public RelationshipsInUpdateRequest Relationships { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInRequest.cs similarity index 84% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInRequest.cs index b3f1e9f89a..f317498810 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInRequest.cs @@ -5,15 +5,21 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; -// ReSharper disable once UnusedTypeParameter -[UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal class ResourceIdentifierInRequest : IResourceIdentity - where TResource : IIdentifiable +internal class IdentifierInRequest : IHasMeta { [Required] [JsonPropertyName("type")] public string Type { get; set; } = null!; + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} + +// ReSharper disable once UnusedTypeParameter +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal class IdentifierInRequest : IdentifierInRequest, IResourceIdentity + where TResource : IIdentifiable +{ [MinLength(1)] [JsonPropertyName("id")] public string Id { get; set; } = null!; @@ -21,7 +27,4 @@ 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/IdentifierInResponse.cs similarity index 88% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInResponse.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInResponse.cs index d32630de9f..47bf94ce17 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; // ReSharper disable once UnusedTypeParameter [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceIdentifierInResponse : IResourceIdentity +internal sealed class IdentifierInResponse : IResourceIdentity where TResource : IIdentifiable { [Required] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs index 19dc3fad3c..34afbf1dc2 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs @@ -6,7 +6,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class RelationshipIdentifier : ResourceIdentifierInRequest +internal sealed class RelationshipIdentifier : IdentifierInRequest where TResource : IIdentifiable { [Required] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateResourceRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateRequest.cs similarity index 57% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateResourceRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateRequest.cs index 9d038dff1e..44698c3b57 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateResourceRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateRequest.cs @@ -2,6 +2,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +internal abstract class RelationshipsInCreateRequest; + // ReSharper disable once UnusedTypeParameter -internal sealed class AttributesInUpdateResourceRequest +internal sealed class RelationshipsInCreateRequest : RelationshipsInCreateRequest where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInResponse.cs index 19d21b8352..24222743ce 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInResponse.cs @@ -2,6 +2,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +internal abstract class RelationshipsInResponse; + // ReSharper disable once UnusedTypeParameter -internal sealed class RelationshipsInResponse +internal sealed class RelationshipsInResponse : RelationshipsInResponse where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateResourceRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateRequest.cs similarity index 57% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateResourceRequest.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateRequest.cs index 866de7b049..bc851b97d5 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateResourceRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateRequest.cs @@ -2,6 +2,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +internal abstract class RelationshipsInUpdateRequest; + // ReSharper disable once UnusedTypeParameter -internal sealed class RelationshipsInUpdateResourceRequest +internal sealed class RelationshipsInUpdateRequest : RelationshipsInUpdateRequest where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInCreateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..838ab6a4ca --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInCreateRequest.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class ResourceInCreateRequest : ResourceData; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInResponse.cs new file mode 100644 index 0000000000..2df01cc319 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInResponse.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class ResourceInResponse : ResourceData; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInUpdateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..63e5faae72 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInUpdateRequest.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class ResourceInUpdateRequest : ResourceData; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestAccessor.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestAccessor.cs new file mode 100644 index 0000000000..b466d78442 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestAccessor.cs @@ -0,0 +1,21 @@ +using JsonApiDotNetCore.Middleware; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +internal sealed class JsonApiRequestAccessor : IJsonApiRequestAccessor +{ + private readonly IHttpContextAccessor _httpContextAccessor; + + /// + public IJsonApiRequest? Current => _httpContextAccessor.HttpContext?.RequestServices.GetService(); + + public JsonApiRequestAccessor(IHttpContextAccessor httpContextAccessor) + { + ArgumentNullException.ThrowIfNull(httpContextAccessor); + + _httpContextAccessor = httpContextAccessor; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaFacts.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaFacts.cs index bc2eea877c..bf91aed0e7 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaFacts.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaFacts.cs @@ -9,27 +9,27 @@ internal static class JsonApiSchemaFacts { private static readonly Type[] RequestBodySchemaTypes = [ - typeof(CreateResourceRequestDocument<>), - typeof(UpdateResourceRequestDocument<>), - typeof(ToOneRelationshipInRequest<>), - typeof(NullableToOneRelationshipInRequest<>), - typeof(ToManyRelationshipInRequest<>), + typeof(CreateRequestDocument<>), + typeof(UpdateRequestDocument<>), + typeof(ToOneInRequest<>), + typeof(NullableToOneInRequest<>), + typeof(ToManyInRequest<>), typeof(OperationsRequestDocument) ]; private static readonly Type[] SchemaTypesHavingNullableDataProperty = [ - typeof(NullableToOneRelationshipInRequest<>), - typeof(NullableToOneRelationshipInResponse<>), - typeof(NullableSecondaryResourceResponseDocument<>), - typeof(NullableResourceIdentifierResponseDocument<>) + typeof(NullableToOneInRequest<>), + typeof(NullableToOneInResponse<>), + typeof(NullableSecondaryResponseDocument<>), + typeof(NullableIdentifierResponseDocument<>) ]; private static readonly Type[] RelationshipInResponseSchemaTypes = [ - typeof(ToOneRelationshipInResponse<>), - typeof(ToManyRelationshipInResponse<>), - typeof(NullableToOneRelationshipInResponse<>) + typeof(ToOneInResponse<>), + typeof(ToManyInResponse<>), + typeof(NullableToOneInResponse<>) ]; public static bool IsRequestBodySchemaType(Type schemaType) diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs index 6790f94f0f..0e2fc803de 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs @@ -28,40 +28,47 @@ internal sealed class JsonApiSchemaIdSelector private static readonly Dictionary SchemaTypeToTemplateMap = new() { - [typeof(CreateResourceRequestDocument<>)] = "Create [ResourceName] Request Document", - [typeof(UpdateResourceRequestDocument<>)] = "Update [ResourceName] Request Document", - [typeof(DataInCreateResourceRequest<>)] = "Data In Create [ResourceName] Request", - [typeof(AttributesInCreateResourceRequest<>)] = "Attributes In Create [ResourceName] Request", - [typeof(RelationshipsInCreateResourceRequest<>)] = "Relationships In Create [ResourceName] Request", - [typeof(DataInUpdateResourceRequest<>)] = "Data In Update [ResourceName] Request", - [typeof(AttributesInUpdateResourceRequest<>)] = "Attributes In Update [ResourceName] Request", - [typeof(RelationshipsInUpdateResourceRequest<>)] = "Relationships In Update [ResourceName] Request", - [typeof(ToOneRelationshipInRequest<>)] = "To One [ResourceName] In Request", - [typeof(NullableToOneRelationshipInRequest<>)] = "Nullable To One [ResourceName] In Request", - [typeof(ToManyRelationshipInRequest<>)] = "To Many [ResourceName] In Request", - [typeof(PrimaryResourceResponseDocument<>)] = "[ResourceName] Primary Response Document", - [typeof(SecondaryResourceResponseDocument<>)] = "[ResourceName] Secondary Response Document", - [typeof(NullableSecondaryResourceResponseDocument<>)] = "Nullable [ResourceName] Secondary Response Document", - [typeof(ResourceCollectionResponseDocument<>)] = "[ResourceName] Collection Response Document", - [typeof(ResourceIdentifierResponseDocument<>)] = "[ResourceName] Identifier Response Document", - [typeof(NullableResourceIdentifierResponseDocument<>)] = "Nullable [ResourceName] Identifier Response Document", - [typeof(ResourceIdentifierCollectionResponseDocument<>)] = "[ResourceName] Identifier Collection Response Document", - [typeof(ToOneRelationshipInResponse<>)] = "To One [ResourceName] In Response", - [typeof(NullableToOneRelationshipInResponse<>)] = "Nullable To One [ResourceName] In Response", - [typeof(ToManyRelationshipInResponse<>)] = "To Many [ResourceName] In Response", - [typeof(ResourceData)] = "Data In Response", - [typeof(ResourceDataInResponse<>)] = "[ResourceName] Data In Response", - [typeof(AttributesInResponse<>)] = "[ResourceName] Attributes In Response", - [typeof(RelationshipsInResponse<>)] = "[ResourceName] Relationships In Response", - [typeof(ResourceIdentifierInRequest<>)] = "[ResourceName] Identifier In Request", - [typeof(ResourceIdentifierInResponse<>)] = "[ResourceName] Identifier In Response", - [typeof(CreateResourceOperation<>)] = "Create [ResourceName] Operation", - [typeof(UpdateResourceOperation<>)] = "Update [ResourceName] Operation", - [typeof(DeleteResourceOperation<>)] = "Delete [ResourceName] Operation", + [typeof(CreateRequestDocument<>)] = "Create [ResourceName] Request Document", + [typeof(UpdateRequestDocument<>)] = "Update [ResourceName] Request Document", + [typeof(ResourceInCreateRequest)] = "Resource In Create Request", + [typeof(DataInCreateRequest<>)] = "Data In Create [ResourceName] Request", + [typeof(AttributesInCreateRequest)] = "Attributes In Create Request", + [typeof(AttributesInCreateRequest<>)] = "Attributes In Create [ResourceName] Request", + [typeof(RelationshipsInCreateRequest)] = "Relationships In Create Request", + [typeof(RelationshipsInCreateRequest<>)] = "Relationships In Create [ResourceName] Request", + [typeof(ResourceInUpdateRequest)] = "Resource In Update Request", + [typeof(DataInUpdateRequest<>)] = "Data In Update [ResourceName] Request", + [typeof(AttributesInUpdateRequest)] = "Attributes In Update Request", + [typeof(AttributesInUpdateRequest<>)] = "Attributes In Update [ResourceName] Request", + [typeof(RelationshipsInUpdateRequest)] = "Relationships In Update Request", + [typeof(RelationshipsInUpdateRequest<>)] = "Relationships In Update [ResourceName] Request", + [typeof(ToOneInRequest<>)] = "To One [ResourceName] In Request", + [typeof(NullableToOneInRequest<>)] = "Nullable To One [ResourceName] In Request", + [typeof(ToManyInRequest<>)] = "To Many [ResourceName] In Request", + [typeof(PrimaryResponseDocument<>)] = "Primary [ResourceName] Response Document", + [typeof(SecondaryResponseDocument<>)] = "Secondary [ResourceName] Response Document", + [typeof(NullableSecondaryResponseDocument<>)] = "Nullable Secondary [ResourceName] Response Document", + [typeof(CollectionResponseDocument<>)] = "[ResourceName] Collection Response Document", + [typeof(IdentifierResponseDocument<>)] = "[ResourceName] Identifier Response Document", + [typeof(NullableIdentifierResponseDocument<>)] = "Nullable [ResourceName] Identifier Response Document", + [typeof(IdentifierCollectionResponseDocument<>)] = "[ResourceName] Identifier Collection Response Document", + [typeof(ToOneInResponse<>)] = "To One [ResourceName] In Response", + [typeof(NullableToOneInResponse<>)] = "Nullable To One [ResourceName] In Response", + [typeof(ToManyInResponse<>)] = "To Many [ResourceName] In Response", + [typeof(ResourceInResponse)] = "Resource In Response", + [typeof(DataInResponse<>)] = "Data In [ResourceName] Response", + [typeof(AttributesInResponse<>)] = "Attributes In [ResourceName] Response", + [typeof(RelationshipsInResponse<>)] = "Relationships In [ResourceName] Response", + [typeof(IdentifierInRequest)] = "Identifier In Request", + [typeof(IdentifierInRequest<>)] = "[ResourceName] Identifier In Request", + [typeof(IdentifierInResponse<>)] = "[ResourceName] Identifier In Response", + [typeof(CreateOperation<>)] = "Create [ResourceName] Operation", + [typeof(UpdateOperation<>)] = "Update [ResourceName] Operation", + [typeof(DeleteOperation<>)] = "Delete [ResourceName] Operation", [typeof(UpdateToOneRelationshipOperation<>)] = "Temporary Update [ResourceName] To One Relationship Operation", [typeof(UpdateToManyRelationshipOperation<>)] = "Temporary Update [ResourceName] To Many Relationship Operation", - [typeof(AddToRelationshipOperation<>)] = "Temporary Add To [ResourceName] To Many Relationship Operation", - [typeof(RemoveFromRelationshipOperation<>)] = "Temporary Remove From [ResourceName] To Many Relationship Operation" + [typeof(AddToRelationshipOperation<>)] = "Temporary Add To [ResourceName] Relationship Operation", + [typeof(RemoveFromRelationshipOperation<>)] = "Temporary Remove From [ResourceName] Relationship Operation" }; private readonly IJsonApiOptions _options; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiApplicationBuilderEvents.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiApplicationBuilderEvents.cs new file mode 100644 index 0000000000..b9cfddd772 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiApplicationBuilderEvents.cs @@ -0,0 +1,23 @@ +using JsonApiDotNetCore.Configuration; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class OpenApiApplicationBuilderEvents : IJsonApiApplicationBuilderEvents +{ + private readonly IJsonApiOptions _options; + private readonly IJsonApiRequestAccessor _requestAccessor; + + public OpenApiApplicationBuilderEvents(IJsonApiOptions options, IJsonApiRequestAccessor requestAccessor) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(requestAccessor); + + _options = options; + _requestAccessor = requestAccessor; + } + + public void ResourceGraphBuilt(IResourceGraph resourceGraph) + { + _options.SerializerOptions.Converters.Add(new OpenApiResourceObjectConverter(resourceGraph, _requestAccessor)); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiContentNegotiator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiContentNegotiator.cs new file mode 100644 index 0000000000..2678cb122e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiContentNegotiator.cs @@ -0,0 +1,71 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using Microsoft.AspNetCore.Http; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class OpenApiContentNegotiator(IJsonApiOptions options, IHttpContextAccessor httpContextAccessor) + : JsonApiContentNegotiator(options, httpContextAccessor) +{ + private readonly IJsonApiOptions _options = options; + + protected override JsonApiMediaType? GetDefaultMediaType(IReadOnlyList possibleMediaTypes, JsonApiMediaType? requestMediaType) + { + if (requestMediaType != null && possibleMediaTypes.Contains(requestMediaType)) + { + // Bug workaround: NSwag doesn't send an Accept header when only non-success responses define a Content-Type. + // This occurs on POST/PATCH/DELETE at a JSON:API relationships endpoint. + return requestMediaType; + } + + return base.GetDefaultMediaType(possibleMediaTypes, requestMediaType); + } + + protected override IReadOnlyList GetPossibleMediaTypes() + { + List mediaTypes = []; + + // JSON:API compliant entries come after relaxed entries, which makes them less likely to be selected. + // This improves compatibility with client generators, which often generate broken code due to the double quotes. + + if (IsOperationsEndpoint()) + { + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.RelaxedAtomicOperations)) + { + mediaTypes.Add(JsonApiMediaType.RelaxedAtomicOperations); + } + + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.AtomicOperations)) + { + mediaTypes.Add(JsonApiMediaType.AtomicOperations); + } + + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.RelaxedAtomicOperations) && + _options.Extensions.Contains(OpenApiMediaTypeExtension.RelaxedOpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.RelaxedAtomicOperationsWithRelaxedOpenApi); + } + + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.AtomicOperations) && _options.Extensions.Contains(OpenApiMediaTypeExtension.OpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.AtomicOperationsWithOpenApi); + } + } + else + { + if (_options.Extensions.Contains(OpenApiMediaTypeExtension.RelaxedOpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.RelaxedOpenApi); + } + + if (_options.Extensions.Contains(OpenApiMediaTypeExtension.OpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.OpenApi); + } + + mediaTypes.Add(JsonApiMediaType.Default); + } + + return mediaTypes.AsReadOnly(); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs index 3d67bb9a9a..8136b2011c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs @@ -144,7 +144,7 @@ private void SetResponseMetadata(ActionModel action, JsonApiEndpointWrapper endp private JsonApiMediaType GetMediaTypeForEndpoint(JsonApiEndpointWrapper endpoint) { - return endpoint.IsAtomicOperationsEndpoint ? JsonApiMediaType.RelaxedAtomicOperations : JsonApiMediaType.Default; + return endpoint.IsAtomicOperationsEndpoint ? OpenApiMediaTypes.RelaxedAtomicOperationsWithRelaxedOpenApi : OpenApiMediaTypes.RelaxedOpenApi; } private static HttpStatusCode[] GetSuccessStatusCodesForEndpoint(JsonApiEndpointWrapper endpoint) diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypeExtension.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypeExtension.cs new file mode 100644 index 0000000000..64abe96e97 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypeExtension.cs @@ -0,0 +1,14 @@ +using JsonApiDotNetCore.Middleware; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +#pragma warning disable AV1008 // Class should not be static + +internal static class OpenApiMediaTypeExtension +{ + public const string ExtensionNamespace = "openapi"; + public const string DiscriminatorPropertyName = "discriminator"; + public const string FullyQualifiedOpenApiDiscriminatorPropertyName = $"{ExtensionNamespace}:{DiscriminatorPropertyName}"; + public static readonly JsonApiMediaTypeExtension OpenApi = new("https://www.jsonapi.net/ext/openapi"); + public static readonly JsonApiMediaTypeExtension RelaxedOpenApi = new("openapi"); +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypes.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypes.cs new file mode 100644 index 0000000000..29cc134c34 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypes.cs @@ -0,0 +1,21 @@ +using JsonApiDotNetCore.Middleware; + +#pragma warning disable AV1008 // Class should not be static + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class OpenApiMediaTypes +{ + public static readonly JsonApiMediaType OpenApi = new([OpenApiMediaTypeExtension.OpenApi]); + public static readonly JsonApiMediaType RelaxedOpenApi = new([OpenApiMediaTypeExtension.RelaxedOpenApi]); + + public static readonly JsonApiMediaType AtomicOperationsWithOpenApi = new([ + JsonApiMediaTypeExtension.AtomicOperations, + OpenApiMediaTypeExtension.OpenApi + ]); + + public static readonly JsonApiMediaType RelaxedAtomicOperationsWithRelaxedOpenApi = new([ + JsonApiMediaTypeExtension.RelaxedAtomicOperations, + OpenApiMediaTypeExtension.RelaxedOpenApi + ]); +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs index 5596b3a681..2688fce4e2 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs @@ -22,19 +22,19 @@ internal sealed class OpenApiOperationIdSelector private static readonly Dictionary SchemaOpenTypeToOpenApiOperationIdTemplateMap = new() { - [typeof(ResourceCollectionResponseDocument<>)] = ResourceCollectionIdTemplate, - [typeof(PrimaryResourceResponseDocument<>)] = ResourceIdTemplate, - [typeof(CreateResourceRequestDocument<>)] = ResourceIdTemplate, - [typeof(UpdateResourceRequestDocument<>)] = ResourceIdTemplate, + [typeof(CollectionResponseDocument<>)] = ResourceCollectionIdTemplate, + [typeof(PrimaryResponseDocument<>)] = ResourceIdTemplate, + [typeof(CreateRequestDocument<>)] = ResourceIdTemplate, + [typeof(UpdateRequestDocument<>)] = ResourceIdTemplate, [typeof(void)] = ResourceIdTemplate, - [typeof(SecondaryResourceResponseDocument<>)] = SecondaryResourceIdTemplate, - [typeof(NullableSecondaryResourceResponseDocument<>)] = SecondaryResourceIdTemplate, - [typeof(ResourceIdentifierCollectionResponseDocument<>)] = RelationshipIdTemplate, - [typeof(ResourceIdentifierResponseDocument<>)] = RelationshipIdTemplate, - [typeof(NullableResourceIdentifierResponseDocument<>)] = RelationshipIdTemplate, - [typeof(ToOneRelationshipInRequest<>)] = RelationshipIdTemplate, - [typeof(NullableToOneRelationshipInRequest<>)] = RelationshipIdTemplate, - [typeof(ToManyRelationshipInRequest<>)] = RelationshipIdTemplate, + [typeof(SecondaryResponseDocument<>)] = SecondaryResourceIdTemplate, + [typeof(NullableSecondaryResponseDocument<>)] = SecondaryResourceIdTemplate, + [typeof(IdentifierCollectionResponseDocument<>)] = RelationshipIdTemplate, + [typeof(IdentifierResponseDocument<>)] = RelationshipIdTemplate, + [typeof(NullableIdentifierResponseDocument<>)] = RelationshipIdTemplate, + [typeof(ToOneInRequest<>)] = RelationshipIdTemplate, + [typeof(NullableToOneInRequest<>)] = RelationshipIdTemplate, + [typeof(ToManyInRequest<>)] = RelationshipIdTemplate, [typeof(OperationsRequestDocument)] = AtomicOperationsIdTemplate }; @@ -85,9 +85,9 @@ private static Type GetBodyType(ApiDescription endpoint) ControllerParameterDescriptor? requestBodyDescriptor = endpoint.ActionDescriptor.GetBodyParameterDescriptor(); Type bodyType = (requestBodyDescriptor?.ParameterType ?? producesResponseTypeAttribute.Type).ConstructedToOpenType(); - if (bodyType == typeof(ResourceCollectionResponseDocument<>) && endpoint.ParameterDescriptions.Count > 0) + if (bodyType == typeof(CollectionResponseDocument<>) && endpoint.ParameterDescriptions.Count > 0) { - bodyType = typeof(SecondaryResourceResponseDocument<>); + bodyType = typeof(SecondaryResponseDocument<>); } return bodyType; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiResourceObjectConverter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiResourceObjectConverter.cs new file mode 100644 index 0000000000..dd7c9503e7 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiResourceObjectConverter.cs @@ -0,0 +1,106 @@ +using System.Net; +using System.Text.Json; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Errors; +using JsonApiDotNetCore.Serialization.JsonConverters; +using JsonApiDotNetCore.Serialization.Objects; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class OpenApiResourceObjectConverter : ResourceObjectConverter +{ + private readonly IJsonApiRequestAccessor _requestAccessor; + + private bool HasOpenApiExtension + { + get + { + if (_requestAccessor.Current == null) + { + return false; + } + + return _requestAccessor.Current.Extensions.Contains(OpenApiMediaTypeExtension.OpenApi) || + _requestAccessor.Current.Extensions.Contains(OpenApiMediaTypeExtension.RelaxedOpenApi); + } + } + + public OpenApiResourceObjectConverter(IResourceGraph resourceGraph, IJsonApiRequestAccessor requestAccessor) + : base(resourceGraph) + { + ArgumentNullException.ThrowIfNull(requestAccessor); + + _requestAccessor = requestAccessor; + } + + private protected override void ValidateExtensionInAttributes(string extensionNamespace, string extensionName, ResourceType resourceType, + Utf8JsonReader reader) + { + if (IsOpenApiDiscriminator(extensionNamespace, extensionName)) + { + const string jsonPointer = $"attributes/{OpenApiMediaTypeExtension.ExtensionNamespace}:{OpenApiMediaTypeExtension.DiscriminatorPropertyName}"; + ValidateOpenApiDiscriminatorValue(resourceType, jsonPointer, reader); + } + else + { + base.ValidateExtensionInAttributes(extensionNamespace, extensionName, resourceType, reader); + } + } + + private protected override void ValidateExtensionInRelationships(string extensionNamespace, string extensionName, ResourceType resourceType, + Utf8JsonReader reader) + { + if (IsOpenApiDiscriminator(extensionNamespace, extensionName)) + { + const string jsonPointer = $"relationships/{OpenApiMediaTypeExtension.ExtensionNamespace}:{OpenApiMediaTypeExtension.DiscriminatorPropertyName}"; + ValidateOpenApiDiscriminatorValue(resourceType, jsonPointer, reader); + } + else + { + base.ValidateExtensionInRelationships(extensionNamespace, extensionName, resourceType, reader); + } + } + + private protected override void WriteExtensionInAttributes(Utf8JsonWriter writer, ResourceObject value) + { + if (HasOpenApiExtension) + { + writer.WriteString(OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, value.Type); + } + } + + private protected override void WriteExtensionInRelationships(Utf8JsonWriter writer, ResourceObject value) + { + if (HasOpenApiExtension) + { + writer.WriteString(OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, value.Type); + } + } + + private bool IsOpenApiDiscriminator(string extensionNamespace, string extensionName) + { + return HasOpenApiExtension && extensionNamespace == OpenApiMediaTypeExtension.ExtensionNamespace && + extensionName == OpenApiMediaTypeExtension.DiscriminatorPropertyName; + } + + private static void ValidateOpenApiDiscriminatorValue(ResourceType resourceType, string relativeJsonPointer, Utf8JsonReader reader) + { + string? discriminatorValue = reader.GetString(); + + if (discriminatorValue != resourceType.PublicName) + { + var jsonApiException = new JsonApiException(new ErrorObject(HttpStatusCode.Conflict) + { + Title = "Incompatible resource type found.", + Detail = + $"Expected {OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName} with value '{resourceType.PublicName}' instead of '{discriminatorValue}'.", + Source = new ErrorSource + { + Pointer = relativeJsonPointer + } + }); + + CapturedThrow(jsonApiException); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs deleted file mode 100644 index a33993a71c..0000000000 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs +++ /dev/null @@ -1,243 +0,0 @@ -using System.Diagnostics; -using JsonApiDotNetCore.AtomicOperations; -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.Middleware; -using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; -using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; -using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; -using JsonApiDotNetCore.Resources.Annotations; -using JsonApiDotNetCore.Serialization.Objects; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; - -namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Bodies; - -/// -/// Generates the OpenAPI component schema for an atomic:operations request/response body. -/// -internal sealed class AtomicOperationsBodySchemaGenerator : BodySchemaGenerator -{ - private readonly SchemaGenerator _defaultSchemaGenerator; - private readonly AtomicOperationCodeSchemaGenerator _atomicOperationCodeSchemaGenerator; - private readonly ResourceIdentifierSchemaGenerator _resourceIdentifierSchemaGenerator; - private readonly RelationshipIdentifierSchemaGenerator _relationshipIdentifierSchemaGenerator; - private readonly AbstractAtomicOperationSchemaGenerator _abstractAtomicOperationSchemaGenerator; - private readonly DataContainerSchemaGenerator _dataContainerSchemaGenerator; - private readonly IAtomicOperationFilter _atomicOperationFilter; - private readonly JsonApiSchemaIdSelector _schemaIdSelector; - private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; - private readonly IResourceGraph _resourceGraph; - - public AtomicOperationsBodySchemaGenerator(SchemaGenerator defaultSchemaGenerator, AtomicOperationCodeSchemaGenerator atomicOperationCodeSchemaGenerator, - ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, RelationshipIdentifierSchemaGenerator relationshipIdentifierSchemaGenerator, - AbstractAtomicOperationSchemaGenerator abstractAtomicOperationSchemaGenerator, DataContainerSchemaGenerator dataContainerSchemaGenerator, - MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IAtomicOperationFilter atomicOperationFilter, - JsonApiSchemaIdSelector schemaIdSelector, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, IJsonApiOptions options, - IResourceGraph resourceGraph) - : base(metaSchemaGenerator, linksVisibilitySchemaGenerator, options) - { - ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); - ArgumentNullException.ThrowIfNull(atomicOperationCodeSchemaGenerator); - ArgumentNullException.ThrowIfNull(resourceIdentifierSchemaGenerator); - ArgumentNullException.ThrowIfNull(relationshipIdentifierSchemaGenerator); - ArgumentNullException.ThrowIfNull(abstractAtomicOperationSchemaGenerator); - ArgumentNullException.ThrowIfNull(dataContainerSchemaGenerator); - ArgumentNullException.ThrowIfNull(atomicOperationFilter); - ArgumentNullException.ThrowIfNull(schemaIdSelector); - ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); - ArgumentNullException.ThrowIfNull(resourceGraph); - - _defaultSchemaGenerator = defaultSchemaGenerator; - _atomicOperationCodeSchemaGenerator = atomicOperationCodeSchemaGenerator; - _resourceIdentifierSchemaGenerator = resourceIdentifierSchemaGenerator; - _relationshipIdentifierSchemaGenerator = relationshipIdentifierSchemaGenerator; - _abstractAtomicOperationSchemaGenerator = abstractAtomicOperationSchemaGenerator; - _dataContainerSchemaGenerator = dataContainerSchemaGenerator; - _atomicOperationFilter = atomicOperationFilter; - _schemaIdSelector = schemaIdSelector; - _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; - _resourceGraph = resourceGraph; - } - - public override bool CanGenerate(Type modelType) - { - return modelType == typeof(OperationsRequestDocument) || modelType == typeof(OperationsResponseDocument); - } - - protected override OpenApiSchema GenerateBodySchema(Type bodyType, SchemaRepository schemaRepository) - { - bool isRequestSchema = bodyType == typeof(OperationsRequestDocument); - - if (isRequestSchema) - { - GenerateSchemasForRequestBody(schemaRepository); - } - else - { - GenerateSchemasForResponseBody(schemaRepository); - } - - return _defaultSchemaGenerator.GenerateSchema(bodyType, schemaRepository); - } - - private void GenerateSchemasForRequestBody(SchemaRepository schemaRepository) - { - // There's no way to intercept in the Swashbuckle recursive component schema generation when using schema inheritance, which we need - // to perform generic type expansions. As a workaround, we generate an empty base schema upfront. And each time the schema - // for a derived type is generated, we'll add it to the discriminator mapping. - _ = _abstractAtomicOperationSchemaGenerator.GenerateSchema(schemaRepository); - - foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes()) - { - GenerateSchemaForOperation(resourceType, schemaRepository); - } - } - - private void GenerateSchemaForOperation(ResourceType resourceType, SchemaRepository schemaRepository) - { - GenerateSchemaForResourceOperation(typeof(CreateResourceOperation<>), resourceType, AtomicOperationCode.Add, schemaRepository); - GenerateSchemaForResourceOperation(typeof(UpdateResourceOperation<>), resourceType, AtomicOperationCode.Update, schemaRepository); - GenerateSchemaForResourceOperation(typeof(DeleteResourceOperation<>), resourceType, AtomicOperationCode.Remove, schemaRepository); - - foreach (RelationshipAttribute relationship in resourceType.Relationships) - { - if (relationship is HasOneAttribute) - { - GenerateSchemaForRelationshipOperation(typeof(UpdateToOneRelationshipOperation<>), relationship, AtomicOperationCode.Update, schemaRepository); - } - else - { - GenerateSchemaForRelationshipOperation(typeof(AddToRelationshipOperation<>), relationship, AtomicOperationCode.Add, schemaRepository); - GenerateSchemaForRelationshipOperation(typeof(UpdateToManyRelationshipOperation<>), relationship, AtomicOperationCode.Update, schemaRepository); - GenerateSchemaForRelationshipOperation(typeof(RemoveFromRelationshipOperation<>), relationship, AtomicOperationCode.Remove, schemaRepository); - } - } - } - - private void GenerateSchemaForResourceOperation(Type operationOpenType, ResourceType resourceType, AtomicOperationCode operationCode, - SchemaRepository schemaRepository) - { - WriteOperationKind writeOperation = operationCode switch - { - AtomicOperationCode.Add => WriteOperationKind.CreateResource, - AtomicOperationCode.Update => WriteOperationKind.UpdateResource, - AtomicOperationCode.Remove => WriteOperationKind.DeleteResource, - _ => throw new UnreachableException() - }; - - if (!_atomicOperationFilter.IsEnabled(resourceType, writeOperation)) - { - return; - } - - _ = _resourceIdentifierSchemaGenerator.GenerateSchema(resourceType, true, schemaRepository); - - Type operationConstructedType = operationOpenType.MakeGenericType(resourceType.ClrType); - bool hasDataProperty = operationOpenType != typeof(DeleteResourceOperation<>); - - if (hasDataProperty) - { - _ = _dataContainerSchemaGenerator.GenerateSchema(operationConstructedType, resourceType, true, schemaRepository); - } - - OpenApiSchema referenceSchemaForOperation = _defaultSchemaGenerator.GenerateSchema(operationConstructedType, schemaRepository); - OpenApiSchema fullSchemaForOperation = schemaRepository.Schemas[referenceSchemaForOperation.Reference.Id]; - fullSchemaForOperation.AdditionalPropertiesAllowed = false; - - OpenApiSchema fullSchemaForDerivedType = fullSchemaForOperation.UnwrapLastExtendedSchema(); - SetOperationCode(fullSchemaForDerivedType, operationCode, schemaRepository); - - string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, resourceType); - _abstractAtomicOperationSchemaGenerator.MapDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); - } - - private void GenerateSchemaForRelationshipOperation(Type operationOpenType, RelationshipAttribute relationship, AtomicOperationCode operationCode, - SchemaRepository schemaRepository) - { - WriteOperationKind writeOperation = operationCode switch - { - AtomicOperationCode.Add => WriteOperationKind.AddToRelationship, - AtomicOperationCode.Update => WriteOperationKind.SetRelationship, - AtomicOperationCode.Remove => WriteOperationKind.RemoveFromRelationship, - _ => throw new UnreachableException() - }; - - if (!_atomicOperationFilter.IsEnabled(relationship.LeftType, writeOperation)) - { - return; - } - - if (relationship is HasOneAttribute hasOneRelationship && !IsToOneRelationshipEnabled(hasOneRelationship, writeOperation)) - { - return; - } - - if (relationship is HasManyAttribute hasManyRelationship && !IsToManyRelationshipEnabled(hasManyRelationship, writeOperation)) - { - return; - } - - _ = _resourceIdentifierSchemaGenerator.GenerateSchema(relationship.LeftType, true, schemaRepository); - _ = _resourceIdentifierSchemaGenerator.GenerateSchema(relationship.RightType, true, schemaRepository); - - OpenApiSchema referenceSchemaForRelationshipIdentifier = _relationshipIdentifierSchemaGenerator.GenerateSchema(relationship, schemaRepository); - - Type operationConstructedType = operationOpenType.MakeGenericType(relationship.RightType.ClrType); - _ = _dataContainerSchemaGenerator.GenerateSchema(operationConstructedType, relationship.RightType, true, schemaRepository); - - // 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 = _schemaIdSelector.GetRelationshipAtomicOperationSchemaId(relationship, operationCode); - - OpenApiSchema referenceSchemaForOperation = _defaultSchemaGenerator.GenerateSchema(operationConstructedType, schemaRepository); - OpenApiSchema fullSchemaForOperation = schemaRepository.Schemas[referenceSchemaForOperation.Reference.Id]; - fullSchemaForOperation.AdditionalPropertiesAllowed = false; - - OpenApiSchema fullSchemaForDerivedType = fullSchemaForOperation.UnwrapLastExtendedSchema(); - SetOperationCode(fullSchemaForDerivedType, operationCode, schemaRepository); - - fullSchemaForDerivedType.Properties[JsonApiPropertyName.Ref] = referenceSchemaForRelationshipIdentifier.WrapInExtendedSchema(); - fullSchemaForDerivedType.Properties[JsonApiPropertyName.Data].Nullable = _resourceFieldValidationMetadataProvider.IsNullable(relationship); - - schemaRepository.ReplaceSchemaId(operationConstructedType, schemaId); - referenceSchemaForOperation.Reference.Id = schemaId; - - string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, relationship); - _abstractAtomicOperationSchemaGenerator.MapDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); - } - - private static bool IsToOneRelationshipEnabled(HasOneAttribute relationship, WriteOperationKind writeOperation) - { - return writeOperation switch - { - WriteOperationKind.SetRelationship => relationship.Capabilities.HasFlag(HasOneCapabilities.AllowSet), - _ => throw new UnreachableException() - }; - } - - private static bool IsToManyRelationshipEnabled(HasManyAttribute relationship, WriteOperationKind writeOperation) - { - return writeOperation switch - { - WriteOperationKind.SetRelationship => relationship.Capabilities.HasFlag(HasManyCapabilities.AllowSet), - WriteOperationKind.AddToRelationship => relationship.Capabilities.HasFlag(HasManyCapabilities.AllowAdd), - WriteOperationKind.RemoveFromRelationship => relationship.Capabilities.HasFlag(HasManyCapabilities.AllowRemove), - _ => throw new UnreachableException() - }; - } - - private void SetOperationCode(OpenApiSchema fullSchema, AtomicOperationCode operationCode, SchemaRepository schemaRepository) - { - OpenApiSchema referenceSchema = _atomicOperationCodeSchemaGenerator.GenerateSchema(operationCode, schemaRepository); - fullSchema.Properties[JsonApiPropertyName.Op] = referenceSchema.WrapInExtendedSchema(); - } - - private void GenerateSchemasForResponseBody(SchemaRepository schemaRepository) - { - foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes()) - { - _ = _dataContainerSchemaGenerator.GenerateSchema(typeof(AtomicResult), resourceType, false, schemaRepository); - } - } -} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs deleted file mode 100644 index 99e013b852..0000000000 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs +++ /dev/null @@ -1,85 +0,0 @@ -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; -using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; -using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; -using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; - -namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Bodies; - -/// -/// Generates the OpenAPI component schema for a resource/relationship request/response body. -/// -internal sealed class ResourceOrRelationshipBodySchemaGenerator : BodySchemaGenerator -{ - private static readonly Type[] RequestBodySchemaTypes = - [ - typeof(CreateResourceRequestDocument<>), - typeof(UpdateResourceRequestDocument<>), - typeof(ToOneRelationshipInRequest<>), - typeof(NullableToOneRelationshipInRequest<>), - typeof(ToManyRelationshipInRequest<>) - ]; - - private static readonly Type[] ResponseBodySchemaTypes = - [ - typeof(ResourceCollectionResponseDocument<>), - typeof(PrimaryResourceResponseDocument<>), - typeof(SecondaryResourceResponseDocument<>), - typeof(NullableSecondaryResourceResponseDocument<>), - typeof(ResourceIdentifierResponseDocument<>), - typeof(NullableResourceIdentifierResponseDocument<>), - typeof(ResourceIdentifierCollectionResponseDocument<>) - ]; - - private readonly SchemaGenerator _defaultSchemaGenerator; - private readonly DataContainerSchemaGenerator _dataContainerSchemaGenerator; - private readonly IResourceGraph _resourceGraph; - - public ResourceOrRelationshipBodySchemaGenerator(SchemaGenerator defaultSchemaGenerator, DataContainerSchemaGenerator dataContainerSchemaGenerator, - MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options, - IResourceGraph resourceGraph) - : base(metaSchemaGenerator, linksVisibilitySchemaGenerator, options) - { - ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); - ArgumentNullException.ThrowIfNull(dataContainerSchemaGenerator); - ArgumentNullException.ThrowIfNull(resourceGraph); - - _defaultSchemaGenerator = defaultSchemaGenerator; - _dataContainerSchemaGenerator = dataContainerSchemaGenerator; - _resourceGraph = resourceGraph; - } - - public override bool CanGenerate(Type modelType) - { - Type modelOpenType = modelType.ConstructedToOpenType(); - return RequestBodySchemaTypes.Contains(modelOpenType) || ResponseBodySchemaTypes.Contains(modelOpenType); - } - - protected override OpenApiSchema GenerateBodySchema(Type bodyType, SchemaRepository schemaRepository) - { - ArgumentNullException.ThrowIfNull(bodyType); - ArgumentNullException.ThrowIfNull(schemaRepository); - - if (schemaRepository.TryLookupByType(bodyType, out OpenApiSchema? referenceSchemaForBody)) - { - return referenceSchemaForBody; - } - - var resourceSchemaType = ResourceSchemaType.Create(bodyType, _resourceGraph); - bool isRequestSchema = RequestBodySchemaTypes.Contains(resourceSchemaType.SchemaOpenType); - - _ = _dataContainerSchemaGenerator.GenerateSchema(bodyType, resourceSchemaType.ResourceType, isRequestSchema, schemaRepository); - - referenceSchemaForBody = _defaultSchemaGenerator.GenerateSchema(bodyType, schemaRepository); - OpenApiSchema fullSchemaForBody = schemaRepository.Schemas[referenceSchemaForBody.Reference.Id].UnwrapLastExtendedSchema(); - - if (JsonApiSchemaFacts.HasNullableDataProperty(resourceSchemaType.SchemaOpenType)) - { - fullSchemaForBody.Properties[JsonApiPropertyName.Data].Nullable = true; - } - - return referenceSchemaForBody; - } -} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractAtomicOperationSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractAtomicOperationSchemaGenerator.cs deleted file mode 100644 index bd0869614c..0000000000 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractAtomicOperationSchemaGenerator.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System.Diagnostics; -using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; -using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; - -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; - private readonly JsonApiSchemaIdSelector _schemaIdSelector; - - public AbstractAtomicOperationSchemaGenerator(MetaSchemaGenerator metaSchemaGenerator, JsonApiSchemaIdSelector schemaIdSelector) - { - ArgumentNullException.ThrowIfNull(metaSchemaGenerator); - ArgumentNullException.ThrowIfNull(schemaIdSelector); - - _metaSchemaGenerator = metaSchemaGenerator; - _schemaIdSelector = schemaIdSelector; - } - - public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) - { - ArgumentNullException.ThrowIfNull(schemaRepository); - - if (schemaRepository.TryLookupByType(AtomicOperationAbstractType, out OpenApiSchema? referenceSchema)) - { - return referenceSchema; - } - - OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); - - var fullSchema = new OpenApiSchema - { - Type = "object", - Required = new SortedSet([DiscriminatorPropertyName]), - Properties = new Dictionary - { - [DiscriminatorPropertyName] = new() - { - Type = "string" - }, - [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() - }, - AdditionalPropertiesAllowed = false, - Discriminator = new OpenApiDiscriminator - { - PropertyName = DiscriminatorPropertyName, - Mapping = new SortedDictionary(StringComparer.Ordinal) - }, - Extensions = - { - ["x-abstract"] = new OpenApiBoolean(true) - } - }; - - string schemaId = _schemaIdSelector.GetSchemaId(AtomicOperationAbstractType); - - referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); - schemaRepository.RegisterType(AtomicOperationAbstractType, schemaId); - - return referenceSchema; - } - - public void MapDiscriminator(OpenApiSchema referenceSchemaForOperation, string discriminatorValue, SchemaRepository schemaRepository) - { - ArgumentNullException.ThrowIfNull(referenceSchemaForOperation); - ArgumentNullException.ThrowIfNull(schemaRepository); - - if (!schemaRepository.TryLookupByType(AtomicOperationAbstractType, out OpenApiSchema? referenceSchemaForAbstractOperation)) - { - throw new UnreachableException(); - } - - 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 deleted file mode 100644 index 1d47701863..0000000000 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Diagnostics; -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; -using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; -using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; - -namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; - -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(MetaSchemaGenerator metaSchemaGenerator, JsonApiSchemaIdSelector schemaIdSelector, IResourceGraph resourceGraph) - { - ArgumentNullException.ThrowIfNull(metaSchemaGenerator); - ArgumentNullException.ThrowIfNull(schemaIdSelector); - ArgumentNullException.ThrowIfNull(resourceGraph); - - _metaSchemaGenerator = metaSchemaGenerator; - _schemaIdSelector = schemaIdSelector; - _resourceGraph = resourceGraph; - } - - public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) - { - ArgumentNullException.ThrowIfNull(schemaRepository); - - if (schemaRepository.TryLookupByType(ResourceDataAbstractType, out OpenApiSchema? referenceSchema)) - { - return referenceSchema; - } - - OpenApiSchema referenceSchemaForResourceType = GenerateEmptyResourceTypeSchema(schemaRepository); - OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); - - var fullSchema = new OpenApiSchema - { - Required = new SortedSet([JsonApiPropertyName.Type]), - Type = "object", - Properties = new Dictionary - { - [JsonApiPropertyName.Type] = new() - { - AllOf = [referenceSchemaForResourceType] - }, - [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() - }, - AdditionalPropertiesAllowed = false, - Discriminator = new OpenApiDiscriminator - { - PropertyName = JsonApiPropertyName.Type, - Mapping = new SortedDictionary(StringComparer.Ordinal) - }, - Extensions = - { - ["x-abstract"] = new OpenApiBoolean(true) - } - }; - - string schemaId = _schemaIdSelector.GetSchemaId(ResourceDataAbstractType); - - referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); - schemaRepository.RegisterType(ResourceDataAbstractType, schemaId); - - 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) - { - ArgumentNullException.ThrowIfNull(resourceDataConstructedType); - ArgumentNullException.ThrowIfNull(referenceSchemaForResourceData); - ArgumentNullException.ThrowIfNull(schemaRepository); - - var resourceSchemaType = ResourceSchemaType.Create(resourceDataConstructedType, _resourceGraph); - - if (resourceSchemaType.SchemaOpenType == typeof(ResourceDataInResponse<>)) - { - if (!schemaRepository.TryLookupByType(ResourceDataAbstractType, out OpenApiSchema? referenceSchemaForAbstractResourceData)) - { - throw new UnreachableException(); - } - - OpenApiSchema fullSchemaForAbstractResourceData = schemaRepository.Schemas[referenceSchemaForAbstractResourceData.Reference.Id]; - string dataSchemaId = referenceSchemaForResourceData.Reference.ReferenceV3; - string publicName = resourceSchemaType.ResourceType.PublicName; - - 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/SchemaGenerators/Components/DataContainerSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs index c1dcfeb965..02c831b212 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs @@ -13,61 +13,52 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; /// internal sealed class DataContainerSchemaGenerator { - private readonly AbstractResourceDataSchemaGenerator _abstractResourceDataSchemaGenerator; private readonly DataSchemaGenerator _dataSchemaGenerator; - private readonly IncludeDependencyScanner _includeDependencyScanner; private readonly IResourceGraph _resourceGraph; - public DataContainerSchemaGenerator(AbstractResourceDataSchemaGenerator abstractResourceDataSchemaGenerator, DataSchemaGenerator dataSchemaGenerator, - IncludeDependencyScanner includeDependencyScanner, IResourceGraph resourceGraph) + public DataContainerSchemaGenerator(DataSchemaGenerator dataSchemaGenerator, IResourceGraph resourceGraph) { - ArgumentNullException.ThrowIfNull(abstractResourceDataSchemaGenerator); ArgumentNullException.ThrowIfNull(dataSchemaGenerator); - ArgumentNullException.ThrowIfNull(includeDependencyScanner); ArgumentNullException.ThrowIfNull(resourceGraph); - _abstractResourceDataSchemaGenerator = abstractResourceDataSchemaGenerator; _dataSchemaGenerator = dataSchemaGenerator; - _includeDependencyScanner = includeDependencyScanner; _resourceGraph = resourceGraph; } - public OpenApiSchema GenerateSchema(Type dataContainerConstructedType, ResourceType resourceType, bool forRequestSchema, SchemaRepository schemaRepository) + public OpenApiSchema GenerateSchemaForCommonResourceDataInResponse(SchemaRepository schemaRepository) { - ArgumentNullException.ThrowIfNull(dataContainerConstructedType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + return _dataSchemaGenerator.GenerateSchemaForCommonData(typeof(ResourceInResponse), schemaRepository); + } + + public OpenApiSchema GenerateSchema(Type dataContainerSchemaType, ResourceType resourceType, bool forRequestSchema, bool canIncludeRelated, + SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(dataContainerSchemaType); ArgumentNullException.ThrowIfNull(resourceType); ArgumentNullException.ThrowIfNull(schemaRepository); - if (schemaRepository.TryLookupByType(dataContainerConstructedType, out OpenApiSchema referenceSchemaForData)) + if (schemaRepository.TryLookupByType(dataContainerSchemaType, 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 - // to perform generic type expansions. As a workaround, we generate an empty base schema upfront. And each time the schema - // for a derived type is generated, we'll add it to the discriminator mapping. - _ = _abstractResourceDataSchemaGenerator.GenerateSchema(schemaRepository); - } + Type dataConstructedType = GetElementTypeOfDataProperty(dataContainerSchemaType, resourceType); - Type dataConstructedType = GetElementTypeOfDataProperty(dataContainerConstructedType, resourceType); - - if (!forRequestSchema) + if (canIncludeRelated) { - // Ensure all reachable related resource types are available in the discriminator mapping upfront. - // This is needed to make includes work when not all endpoints are exposed. - EnsureResourceDataInResponseDerivedTypesAreMappedInDiscriminator(dataConstructedType, schemaRepository); - } - - referenceSchemaForData = _dataSchemaGenerator.GenerateSchema(dataConstructedType, schemaRepository); + var resourceSchemaType = ResourceSchemaType.Create(dataConstructedType, _resourceGraph); - if (!forRequestSchema) - { - _abstractResourceDataSchemaGenerator.MapDiscriminator(dataConstructedType, referenceSchemaForData, schemaRepository); + if (resourceSchemaType.SchemaOpenType == typeof(DataInResponse<>)) + { + // Ensure all reachable related resource types in response schemas are generated upfront. + // This is needed to make includes work when not all endpoints are exposed. + GenerateReachableRelatedTypesInResponse(dataConstructedType, schemaRepository); + } } - return referenceSchemaForData; + return _dataSchemaGenerator.GenerateSchema(dataConstructedType, forRequestSchema, schemaRepository); } private static Type GetElementTypeOfDataProperty(Type dataContainerConstructedType, ResourceType resourceType) @@ -83,9 +74,9 @@ private static Type GetElementTypeOfDataProperty(Type dataContainerConstructedTy ? dataProperty.PropertyType.GenericTypeArguments[0] : dataProperty.PropertyType; - if (innerPropertyType == typeof(ResourceData)) + if (innerPropertyType == typeof(ResourceInResponse)) { - return typeof(ResourceDataInResponse<>).MakeGenericType(resourceType.ClrType); + return typeof(DataInResponse<>).MakeGenericType(resourceType.ClrType); } if (!innerPropertyType.IsGenericType) @@ -96,26 +87,19 @@ private static Type GetElementTypeOfDataProperty(Type dataContainerConstructedTy return innerPropertyType; } - private void EnsureResourceDataInResponseDerivedTypesAreMappedInDiscriminator(Type dataConstructedType, SchemaRepository schemaRepository) + private void GenerateReachableRelatedTypesInResponse(Type dataConstructedType, SchemaRepository schemaRepository) { Type dataOpenType = dataConstructedType.GetGenericTypeDefinition(); - if (dataOpenType == typeof(ResourceDataInResponse<>)) + if (dataOpenType == typeof(DataInResponse<>)) { var resourceSchemaType = ResourceSchemaType.Create(dataConstructedType, _resourceGraph); - foreach (ResourceType relatedType in _includeDependencyScanner.GetReachableRelatedTypes(resourceSchemaType.ResourceType)) + foreach (ResourceType relatedType in IncludeDependencyScanner.Instance.GetReachableRelatedTypes(resourceSchemaType.ResourceType)) { - MapResourceDataInResponseDerivedTypeInDiscriminator(relatedType, schemaRepository); + Type resourceDataConstructedType = typeof(DataInResponse<>).MakeGenericType(relatedType.ClrType); + _ = _dataSchemaGenerator.GenerateSchema(resourceDataConstructedType, false, schemaRepository); } } } - - private void MapResourceDataInResponseDerivedTypeInDiscriminator(ResourceType resourceType, SchemaRepository schemaRepository) - { - Type resourceDataConstructedType = typeof(ResourceDataInResponse<>).MakeGenericType(resourceType.ClrType); - OpenApiSchema referenceSchemaForResourceData = _dataSchemaGenerator.GenerateSchema(resourceDataConstructedType, schemaRepository); - - _abstractResourceDataSchemaGenerator.MapDiscriminator(resourceDataConstructedType, referenceSchemaForResourceData, schemaRepository); - } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs index a051d3072f..c2fbefa09c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs @@ -1,3 +1,6 @@ +using System.Collections.Concurrent; +using System.Diagnostics; +using System.Reflection; using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; @@ -10,7 +13,12 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; internal sealed class DataSchemaGenerator { - private static readonly string[] ResourceDataPropertyNamesInOrder = + // Workaround for bug at https://github.com/microsoft/kiota/issues/2432#issuecomment-2436625836. + private static readonly bool RepeatDiscriminatorInResponseDerivedTypes = bool.Parse(bool.TrueString); + + private static readonly ConcurrentDictionary UltimateBaseResourceTypeCache = []; + + private static readonly string[] DataPropertyNamesInOrder = [ JsonApiPropertyName.Type, JsonApiPropertyName.Id, @@ -25,8 +33,9 @@ internal sealed class DataSchemaGenerator private readonly GenerationCacheSchemaGenerator _generationCacheSchemaGenerator; private readonly ResourceTypeSchemaGenerator _resourceTypeSchemaGenerator; private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; - private readonly ResourceIdentifierSchemaGenerator _resourceIdentifierSchemaGenerator; private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; + private readonly MetaSchemaGenerator _metaSchemaGenerator; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; private readonly IJsonApiOptions _options; private readonly IResourceGraph _resourceGraph; private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; @@ -35,7 +44,7 @@ internal sealed class DataSchemaGenerator public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCacheSchemaGenerator generationCacheSchemaGenerator, ResourceTypeSchemaGenerator resourceTypeSchemaGenerator, ResourceIdSchemaGenerator resourceIdSchemaGenerator, - ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, + LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, MetaSchemaGenerator metaSchemaGenerator, JsonApiSchemaIdSelector schemaIdSelector, IJsonApiOptions options, IResourceGraph resourceGraph, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, RelationshipTypeFactory relationshipTypeFactory, ResourceDocumentationReader resourceDocumentationReader) { @@ -43,8 +52,9 @@ public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCac ArgumentNullException.ThrowIfNull(generationCacheSchemaGenerator); ArgumentNullException.ThrowIfNull(resourceTypeSchemaGenerator); ArgumentNullException.ThrowIfNull(resourceIdSchemaGenerator); - ArgumentNullException.ThrowIfNull(resourceIdentifierSchemaGenerator); ArgumentNullException.ThrowIfNull(linksVisibilitySchemaGenerator); + ArgumentNullException.ThrowIfNull(metaSchemaGenerator); + ArgumentNullException.ThrowIfNull(schemaIdSelector); ArgumentNullException.ThrowIfNull(options); ArgumentNullException.ThrowIfNull(resourceGraph); ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); @@ -55,8 +65,9 @@ public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCac _generationCacheSchemaGenerator = generationCacheSchemaGenerator; _resourceTypeSchemaGenerator = resourceTypeSchemaGenerator; _resourceIdSchemaGenerator = resourceIdSchemaGenerator; - _resourceIdentifierSchemaGenerator = resourceIdentifierSchemaGenerator; _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; + _metaSchemaGenerator = metaSchemaGenerator; + _schemaIdSelector = schemaIdSelector; _options = options; _resourceGraph = resourceGraph; _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; @@ -64,8 +75,11 @@ public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCac _resourceDocumentationReader = resourceDocumentationReader; } - public OpenApiSchema GenerateSchema(Type dataSchemaType, SchemaRepository schemaRepository) + public OpenApiSchema GenerateSchema(Type dataSchemaType, bool forRequestSchema, SchemaRepository schemaRepository) { + // For a given resource (identifier) type, we always generate the full type hierarchy. Discriminator mappings + // are managed manually, because there's no way to intercept in the Swashbuckle recursive component schema generation. + ArgumentNullException.ThrowIfNull(dataSchemaType); ArgumentNullException.ThrowIfNull(schemaRepository); @@ -77,29 +91,183 @@ public OpenApiSchema GenerateSchema(Type dataSchemaType, SchemaRepository schema var resourceSchemaType = ResourceSchemaType.Create(dataSchemaType, _resourceGraph); ResourceType resourceType = resourceSchemaType.ResourceType; + Type? commonDataSchemaType = GetCommonSchemaType(resourceSchemaType.SchemaOpenType); + + if (commonDataSchemaType != null) + { + _ = GenerateSchemaForCommonData(commonDataSchemaType, schemaRepository); + } + + if (resourceType.BaseType != null) + { + ResourceType ultimateBaseResourceType = GetUltimateBaseType(resourceType); + Type ultimateBaseSchemaType = ChangeResourceTypeInSchemaType(dataSchemaType, ultimateBaseResourceType); + + _ = GenerateSchema(ultimateBaseSchemaType, forRequestSchema, schemaRepository); + + return schemaRepository.LookupByType(dataSchemaType); + } + referenceSchemaForData = _defaultSchemaGenerator.GenerateSchema(dataSchemaType, schemaRepository); - OpenApiSchema fullSchemaForResourceData = schemaRepository.Schemas[referenceSchemaForData.Reference.Id]; - fullSchemaForResourceData.AdditionalPropertiesAllowed = false; + OpenApiSchema fullSchemaForData = schemaRepository.Schemas[referenceSchemaForData.Reference.Id]; + fullSchemaForData.AdditionalPropertiesAllowed = false; + + OpenApiSchema inlineSchemaForData = fullSchemaForData.UnwrapLastExtendedSchema(); - OpenApiSchema inlineSchemaForResourceData = fullSchemaForResourceData.UnwrapLastExtendedSchema(); - bool isRequestSchema = inlineSchemaForResourceData == fullSchemaForResourceData; + SetAbstract(inlineSchemaForData, resourceSchemaType); + SetResourceType(inlineSchemaForData, resourceType, schemaRepository); + AdaptResourceIdentity(inlineSchemaForData, resourceSchemaType, forRequestSchema, schemaRepository); + SetResourceId(inlineSchemaForData, resourceType, schemaRepository); + SetResourceFields(inlineSchemaForData, resourceSchemaType, forRequestSchema, schemaRepository); + SetDocumentation(fullSchemaForData, resourceType); + SetLinksVisibility(inlineSchemaForData, resourceSchemaType, schemaRepository); - SetAbstract(inlineSchemaForResourceData, resourceType); - SetResourceType(inlineSchemaForResourceData, resourceType, schemaRepository); - AdaptResourceIdentity(inlineSchemaForResourceData, resourceSchemaType, isRequestSchema, schemaRepository); - SetResourceId(inlineSchemaForResourceData, resourceType, schemaRepository); - SetResourceFields(inlineSchemaForResourceData, resourceSchemaType, isRequestSchema, schemaRepository); - SetDocumentation(fullSchemaForResourceData, resourceType); - SetLinksVisibility(inlineSchemaForResourceData, resourceSchemaType, schemaRepository); + if (resourceType.IsPartOfTypeHierarchy()) + { + GenerateDataSchemasForDirectlyDerivedTypes(resourceSchemaType, forRequestSchema, schemaRepository); + } - inlineSchemaForResourceData.ReorderProperties(ResourceDataPropertyNamesInOrder); + inlineSchemaForData.ReorderProperties(DataPropertyNamesInOrder); + + if (commonDataSchemaType != null) + { + MapInDiscriminator(resourceSchemaType, forRequestSchema, JsonApiPropertyName.Type, schemaRepository); + } + + if (RequiresRootObjectTypeInDataSchema(resourceSchemaType, forRequestSchema)) + { + fullSchemaForData.Extensions[SetSchemaTypeToObjectDocumentFilter.RequiresRootObjectTypeKey] = new OpenApiBoolean(true); + } return referenceSchemaForData; } - private static void SetAbstract(OpenApiSchema fullSchema, ResourceType resourceType) + private static Type? GetCommonSchemaType(Type schemaOpenType) { - if (resourceType.ClrType.IsAbstract) + if (schemaOpenType == typeof(IdentifierInRequest<>)) + { + return typeof(IdentifierInRequest); + } + + if (schemaOpenType == typeof(DataInCreateRequest<>)) + { + return typeof(ResourceInCreateRequest); + } + + if (schemaOpenType == typeof(AttributesInCreateRequest<>)) + { + return typeof(AttributesInCreateRequest); + } + + if (schemaOpenType == typeof(RelationshipsInCreateRequest<>)) + { + return typeof(RelationshipsInCreateRequest); + } + + if (schemaOpenType == typeof(DataInUpdateRequest<>)) + { + return typeof(ResourceInUpdateRequest); + } + + if (schemaOpenType == typeof(AttributesInUpdateRequest<>)) + { + return typeof(AttributesInUpdateRequest); + } + + if (schemaOpenType == typeof(RelationshipsInUpdateRequest<>)) + { + return typeof(RelationshipsInUpdateRequest); + } + + if (schemaOpenType == typeof(IdentifierInResponse<>)) + { + return null; + } + + if (schemaOpenType == typeof(DataInResponse<>)) + { + return typeof(ResourceInResponse); + } + + if (schemaOpenType == typeof(AttributesInResponse<>)) + { + return typeof(AttributesInResponse); + } + + if (schemaOpenType == typeof(RelationshipsInResponse<>)) + { + return typeof(RelationshipsInResponse); + } + + throw new UnreachableException(); + } + + public OpenApiSchema GenerateSchemaForCommonData(Type commonDataSchemaType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(commonDataSchemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(commonDataSchemaType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + OpenApiSchema referenceSchemaForResourceType = _resourceTypeSchemaGenerator.GenerateSchema(schemaRepository); + OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); + + var fullSchema = new OpenApiSchema + { + Type = "object", + Required = new SortedSet([JsonApiPropertyName.Type]), + Properties = new Dictionary + { + [JsonApiPropertyName.Type] = referenceSchemaForResourceType.WrapInExtendedSchema(), + [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() + }, + AdditionalPropertiesAllowed = false, + Discriminator = new OpenApiDiscriminator + { + PropertyName = JsonApiPropertyName.Type, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }, + Extensions = + { + ["x-abstract"] = new OpenApiBoolean(true) + } + }; + + string schemaId = _schemaIdSelector.GetSchemaId(commonDataSchemaType); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(commonDataSchemaType, schemaId); + + return referenceSchema; + } + + private static ResourceType GetUltimateBaseType(ResourceType resourceType) + { + return UltimateBaseResourceTypeCache.GetOrAdd(resourceType, type => + { + ResourceType baseType = type; + + while (baseType.BaseType != null) + { + baseType = baseType.BaseType; + } + + return baseType; + }); + } + + private static Type ChangeResourceTypeInSchemaType(Type schemaType, ResourceType resourceType) + { + Type schemaOpenType = schemaType.ConstructedToOpenType(); + return schemaOpenType.MakeGenericType(resourceType.ClrType); + } + + private static void SetAbstract(OpenApiSchema fullSchema, ResourceSchemaType resourceSchemaType) + { + if (resourceSchemaType.ResourceType.ClrType.IsAbstract && resourceSchemaType.SchemaOpenType != typeof(IdentifierInRequest<>)) { fullSchema.Extensions["x-abstract"] = new OpenApiBoolean(true); } @@ -129,7 +297,7 @@ private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceSchemaType fullSchema.Properties.Remove(JsonApiPropertyName.Lid); } - if (resourceSchemaType.SchemaOpenType == typeof(DataInCreateResourceRequest<>)) + if (resourceSchemaType.SchemaOpenType == typeof(DataInCreateRequest<>)) { ClientIdGenerationMode clientIdGeneration = resourceSchemaType.ResourceType.ClientIdGeneration ?? _options.ClientIdGeneration; @@ -183,17 +351,15 @@ private void SetResourceFields(OpenApiSchema fullSchemaForData, ResourceSchemaTy if (schemaHasFields) { - var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_defaultSchemaGenerator, _resourceIdentifierSchemaGenerator, - _linksVisibilitySchemaGenerator, _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceSchemaType); - - ResourceType resourceType = resourceSchemaType.ResourceType; + var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_defaultSchemaGenerator, this, _linksVisibilitySchemaGenerator, + _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceSchemaType); - SetFieldSchemaMembers(fullSchemaForData, resourceType, forRequestSchema, true, fieldSchemaBuilder, schemaRepository); - SetFieldSchemaMembers(fullSchemaForData, resourceType, forRequestSchema, false, fieldSchemaBuilder, schemaRepository); + SetFieldSchemaMembers(fullSchemaForData, resourceSchemaType, forRequestSchema, true, fieldSchemaBuilder, schemaRepository); + SetFieldSchemaMembers(fullSchemaForData, resourceSchemaType, forRequestSchema, false, fieldSchemaBuilder, schemaRepository); } } - private void SetFieldSchemaMembers(OpenApiSchema fullSchemaForData, ResourceType resourceType, bool forRequestSchema, bool forAttributes, + private void SetFieldSchemaMembers(OpenApiSchema fullSchemaForData, ResourceSchemaType resourceSchemaTypeForData, bool forRequestSchema, bool forAttributes, ResourceFieldSchemaBuilder fieldSchemaBuilder, SchemaRepository schemaRepository) { string propertyNameInSchema = forAttributes ? JsonApiPropertyName.Attributes : JsonApiPropertyName.Relationships; @@ -202,7 +368,7 @@ private void SetFieldSchemaMembers(OpenApiSchema fullSchemaForData, ResourceType OpenApiSchema fullSchemaForFields = schemaRepository.Schemas[referenceSchemaForFields.Reference.Id]; fullSchemaForFields.AdditionalPropertiesAllowed = false; - SetAbstract(fullSchemaForFields, resourceType); + SetAbstract(fullSchemaForFields, resourceSchemaTypeForData); if (forAttributes) { @@ -213,9 +379,177 @@ private void SetFieldSchemaMembers(OpenApiSchema fullSchemaForData, ResourceType fieldSchemaBuilder.SetMembersOfRelationships(fullSchemaForFields, forRequestSchema, schemaRepository); } - if (fullSchemaForFields.Properties.Count == 0) + if (fullSchemaForFields.Properties.Count == 0 && !resourceSchemaTypeForData.ResourceType.IsPartOfTypeHierarchy()) { fullSchemaForData.Properties.Remove(propertyNameInSchema); + schemaRepository.Schemas.Remove(referenceSchemaForFields.Reference.Id); + } + else + { + ResourceSchemaType resourceSchemaTypeForFields = + GetResourceSchemaTypeForFieldsProperty(resourceSchemaTypeForData, forAttributes ? "Attributes" : "Relationships"); + + Type? commonFieldsSchemaType = GetCommonSchemaType(resourceSchemaTypeForFields.SchemaOpenType); + + if (commonFieldsSchemaType == null) + { + throw new UnreachableException(); + } + + _ = GenerateSchemaForCommonFields(commonFieldsSchemaType, schemaRepository); + + MapInDiscriminator(resourceSchemaTypeForFields, forRequestSchema, OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, + schemaRepository); + + Type baseSchemaType; + + if (resourceSchemaTypeForFields.ResourceType.BaseType != null) + { + ResourceSchemaType resourceSchemaTypeForBase = + resourceSchemaTypeForFields.ChangeResourceType(resourceSchemaTypeForFields.ResourceType.BaseType); + + baseSchemaType = resourceSchemaTypeForBase.SchemaConstructedType; + } + else + { + baseSchemaType = commonFieldsSchemaType; + } + + OpenApiSchema referenceSchemaForBase = schemaRepository.LookupByType(baseSchemaType); + + schemaRepository.Schemas[referenceSchemaForFields.Reference.Id] = new OpenApiSchema + { + AllOf = + [ + referenceSchemaForBase, + fullSchemaForFields + ], + AdditionalPropertiesAllowed = false + }; + } + } + + private ResourceSchemaType GetResourceSchemaTypeForFieldsProperty(ResourceSchemaType resourceSchemaTypeForData, string propertyName) + { + PropertyInfo? fieldsProperty = resourceSchemaTypeForData.SchemaConstructedType.GetProperty(propertyName); + + if (fieldsProperty == null) + { + throw new UnreachableException(); + } + + Type fieldsConstructedType = fieldsProperty.PropertyType; + return ResourceSchemaType.Create(fieldsConstructedType, _resourceGraph); + } + + private OpenApiSchema GenerateSchemaForCommonFields(Type commonFieldsSchemaType, SchemaRepository schemaRepository) + { + if (schemaRepository.TryLookupByType(commonFieldsSchemaType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + OpenApiSchema referenceSchemaForResourceType = _resourceTypeSchemaGenerator.GenerateSchema(schemaRepository); + + var fullSchema = new OpenApiSchema + { + Type = "object", + Required = new SortedSet([OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName]), + Properties = new Dictionary + { + [OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName] = referenceSchemaForResourceType.WrapInExtendedSchema() + }, + AdditionalPropertiesAllowed = false, + Discriminator = new OpenApiDiscriminator + { + PropertyName = OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }, + Extensions = + { + ["x-abstract"] = new OpenApiBoolean(true) + } + }; + + string schemaId = _schemaIdSelector.GetSchemaId(commonFieldsSchemaType); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(commonFieldsSchemaType, schemaId); + + return referenceSchema; + } + + private void MapInDiscriminator(ResourceSchemaType resourceSchemaType, bool forRequestSchema, string discriminatorPropertyName, + SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchemaForDerived = schemaRepository.LookupByType(resourceSchemaType.SchemaConstructedType); + + foreach (ResourceType? baseResourceType in GetBaseTypesToMapInto(resourceSchemaType, forRequestSchema)) + { + Type baseSchemaType = baseResourceType == null + ? GetCommonSchemaType(resourceSchemaType.SchemaOpenType)! + : resourceSchemaType.ChangeResourceType(baseResourceType).SchemaConstructedType; + + OpenApiSchema referenceSchemaForBase = schemaRepository.LookupByType(baseSchemaType); + OpenApiSchema inlineSchemaForBase = schemaRepository.Schemas[referenceSchemaForBase.Reference.Id].UnwrapLastExtendedSchema(); + + inlineSchemaForBase.Discriminator ??= new OpenApiDiscriminator + { + PropertyName = discriminatorPropertyName, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }; + + if (RepeatDiscriminatorInResponseDerivedTypes && !forRequestSchema) + { + inlineSchemaForBase.Required.Add(discriminatorPropertyName); + } + + string publicName = resourceSchemaType.ResourceType.PublicName; + + if (inlineSchemaForBase.Discriminator.Mapping.TryAdd(publicName, referenceSchemaForDerived.Reference.ReferenceV3) && baseResourceType == null) + { + MapResourceTypeInEnum(publicName, schemaRepository); + } + } + } + + private static IEnumerable GetBaseTypesToMapInto(ResourceSchemaType resourceSchemaType, bool forRequestSchema) + { + bool dependsOnCommonSchemaType = GetCommonSchemaType(resourceSchemaType.SchemaOpenType) != null; + + if (RepeatDiscriminatorInResponseDerivedTypes && !forRequestSchema) + { + ResourceType? baseType = resourceSchemaType.ResourceType.BaseType; + + while (baseType != null) + { + yield return baseType; + + baseType = baseType.BaseType; + } + } + else + { + if (!dependsOnCommonSchemaType) + { + yield return GetUltimateBaseType(resourceSchemaType.ResourceType); + } + } + + if (dependsOnCommonSchemaType) + { + yield return null; + } + } + + private void MapResourceTypeInEnum(string publicName, SchemaRepository schemaRepository) + { + string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(null); + OpenApiSchema fullSchema = schemaRepository.Schemas[schemaId]; + + if (!fullSchema.Enum.Any(openApiAny => openApiAny is OpenApiString openApiString && openApiString.Value == publicName)) + { + fullSchema.Enum.Add(new OpenApiString(publicName)); } } @@ -228,4 +562,78 @@ private void SetLinksVisibility(OpenApiSchema fullSchema, ResourceSchemaType res { _linksVisibilitySchemaGenerator.UpdateSchemaForResource(resourceSchemaType, fullSchema, schemaRepository); } + + private void GenerateDataSchemasForDirectlyDerivedTypes(ResourceSchemaType resourceSchemaType, bool forRequestSchema, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchemaForBase = schemaRepository.LookupByType(resourceSchemaType.SchemaConstructedType); + + foreach (ResourceType derivedType in resourceSchemaType.ResourceType.DirectlyDerivedTypes) + { + ResourceSchemaType resourceSchemaTypeForDerived = resourceSchemaType.ChangeResourceType(derivedType); + Type derivedSchemaType = resourceSchemaTypeForDerived.SchemaConstructedType; + + OpenApiSchema referenceSchemaForDerived = _defaultSchemaGenerator.GenerateSchema(derivedSchemaType, schemaRepository); + OpenApiSchema fullSchemaForDerived = schemaRepository.Schemas[referenceSchemaForDerived.Reference.Id]; + fullSchemaForDerived.AdditionalPropertiesAllowed = false; + + OpenApiSchema inlineSchemaForDerived = fullSchemaForDerived.UnwrapLastExtendedSchema(); + SetResourceFields(inlineSchemaForDerived, resourceSchemaTypeForDerived, forRequestSchema, schemaRepository); + + SetAbstract(inlineSchemaForDerived, resourceSchemaTypeForDerived); + RemoveProperties(inlineSchemaForDerived); + MapInDiscriminator(resourceSchemaTypeForDerived, forRequestSchema, JsonApiPropertyName.Type, schemaRepository); + + if (fullSchemaForDerived.AllOf.Count == 0) + { + var compositeSchemaForDerived = new OpenApiSchema + { + AllOf = + [ + referenceSchemaForBase, + fullSchemaForDerived + ], + AdditionalPropertiesAllowed = false + }; + + schemaRepository.Schemas[referenceSchemaForDerived.Reference.Id] = compositeSchemaForDerived; + } + else + { + fullSchemaForDerived.AllOf[0] = referenceSchemaForBase; + } + + if (RequiresRootObjectTypeInDataSchema(resourceSchemaTypeForDerived, forRequestSchema)) + { + OpenApiSchema fullSchemaForData = schemaRepository.Schemas[referenceSchemaForDerived.Reference.Id]; + fullSchemaForData.Extensions[SetSchemaTypeToObjectDocumentFilter.RequiresRootObjectTypeKey] = new OpenApiBoolean(true); + } + + GenerateDataSchemasForDirectlyDerivedTypes(resourceSchemaTypeForDerived, forRequestSchema, schemaRepository); + } + } + + private static void RemoveProperties(OpenApiSchema fullSchema) + { + foreach (string propertyName in fullSchema.Properties.Keys) + { + fullSchema.Properties.Remove(propertyName); + fullSchema.Required.Remove(propertyName); + } + } + + private static bool RequiresRootObjectTypeInDataSchema(ResourceSchemaType resourceSchemaType, bool forRequestSchema) + { + Type? commonDataSchemaType = GetCommonSchemaType(resourceSchemaType.SchemaOpenType); + + if (forRequestSchema && (commonDataSchemaType == typeof(IdentifierInRequest) || + (!resourceSchemaType.ResourceType.ClrType.IsAbstract && commonDataSchemaType is { IsGenericType: false }))) + { + // Bug workaround for NSwag, which fails to properly infer implicit { "type": "object" } of outer schema when it appears inside an allOf. + // As a result, the required Data property in the generated client is assigned "default!" instead of a new instance. + // But there's another bug on top of that: When the declared type of Data is abstract, it still generates assignment with a new instance, which fails to compile. + return true; + } + + return false; + } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs index 660e4ee94d..5c099a3fc1 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs @@ -31,19 +31,19 @@ internal sealed class LinksVisibilitySchemaGenerator private static readonly Dictionary LinksInJsonApiSchemaTypes = new() { - [typeof(NullableSecondaryResourceResponseDocument<>)] = ResourceTopLinkTypes, - [typeof(PrimaryResourceResponseDocument<>)] = ResourceTopLinkTypes, - [typeof(SecondaryResourceResponseDocument<>)] = ResourceTopLinkTypes, - [typeof(ResourceCollectionResponseDocument<>)] = ResourceCollectionTopLinkTypes, - [typeof(ResourceIdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, - [typeof(NullableResourceIdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, - [typeof(ResourceIdentifierCollectionResponseDocument<>)] = ResourceIdentifierCollectionTopLinkTypes, + [typeof(NullableSecondaryResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(PrimaryResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(SecondaryResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(CollectionResponseDocument<>)] = ResourceCollectionTopLinkTypes, + [typeof(IdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, + [typeof(NullableIdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, + [typeof(IdentifierCollectionResponseDocument<>)] = ResourceIdentifierCollectionTopLinkTypes, [typeof(ErrorResponseDocument)] = ErrorTopLinkTypes, [typeof(OperationsResponseDocument)] = ResourceTopLinkTypes, - [typeof(NullableToOneRelationshipInResponse<>)] = RelationshipLinkTypes, - [typeof(ToManyRelationshipInResponse<>)] = RelationshipLinkTypes, - [typeof(ToOneRelationshipInResponse<>)] = RelationshipLinkTypes, - [typeof(ResourceDataInResponse<>)] = ResourceLinkTypes + [typeof(NullableToOneInResponse<>)] = RelationshipLinkTypes, + [typeof(ToManyInResponse<>)] = RelationshipLinkTypes, + [typeof(ToOneInResponse<>)] = RelationshipLinkTypes, + [typeof(DataInResponse<>)] = ResourceLinkTypes }; private static readonly Dictionary> LinkTypeToPropertyNamesMap = new() @@ -70,12 +70,12 @@ public LinksVisibilitySchemaGenerator(IJsonApiOptions options, IResourceGraph re _lazyLinksVisibility = new Lazy(() => new LinksVisibility(options, resourceGraph), LazyThreadSafetyMode.ExecutionAndPublication); } - public void UpdateSchemaForTopLevel(Type modelType, OpenApiSchema fullSchemaForLinksContainer, SchemaRepository schemaRepository) + public void UpdateSchemaForTopLevel(Type schemaType, OpenApiSchema fullSchemaForLinksContainer, SchemaRepository schemaRepository) { - ArgumentNullException.ThrowIfNull(modelType); + ArgumentNullException.ThrowIfNull(schemaType); ArgumentNullException.ThrowIfNull(fullSchemaForLinksContainer); - Type lookupType = modelType.ConstructedToOpenType(); + Type lookupType = schemaType.ConstructedToOpenType(); if (LinksInJsonApiSchemaTypes.TryGetValue(lookupType, out LinkTypes possibleLinkTypes)) { @@ -94,12 +94,12 @@ public void UpdateSchemaForResource(ResourceSchemaType resourceSchemaType, OpenA } } - public void UpdateSchemaForRelationship(Type modelType, OpenApiSchema fullSchemaForRelationship, SchemaRepository schemaRepository) + public void UpdateSchemaForRelationship(Type schemaType, OpenApiSchema fullSchemaForRelationship, SchemaRepository schemaRepository) { - ArgumentNullException.ThrowIfNull(modelType); + ArgumentNullException.ThrowIfNull(schemaType); ArgumentNullException.ThrowIfNull(fullSchemaForRelationship); - Type lookupType = modelType.ConstructedToOpenType(); + Type lookupType = schemaType.ConstructedToOpenType(); if (LinksInJsonApiSchemaTypes.TryGetValue(lookupType, out LinkTypes possibleLinkTypes)) { diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceIdentifierSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceIdentifierSchemaGenerator.cs deleted file mode 100644 index 0c60bc9069..0000000000 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceIdentifierSchemaGenerator.cs +++ /dev/null @@ -1,66 +0,0 @@ -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; - -namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; - -internal sealed class ResourceIdentifierSchemaGenerator -{ - private readonly SchemaGenerator _defaultSchemaGenerator; - private readonly GenerationCacheSchemaGenerator _generationCacheSchemaGenerator; - private readonly ResourceTypeSchemaGenerator _resourceTypeSchemaGenerator; - private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; - - public ResourceIdentifierSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCacheSchemaGenerator generationCacheSchemaGenerator, - ResourceTypeSchemaGenerator resourceTypeSchemaGenerator, ResourceIdSchemaGenerator resourceIdSchemaGenerator) - { - ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); - ArgumentNullException.ThrowIfNull(generationCacheSchemaGenerator); - ArgumentNullException.ThrowIfNull(resourceTypeSchemaGenerator); - ArgumentNullException.ThrowIfNull(resourceIdSchemaGenerator); - - _defaultSchemaGenerator = defaultSchemaGenerator; - _generationCacheSchemaGenerator = generationCacheSchemaGenerator; - _resourceTypeSchemaGenerator = resourceTypeSchemaGenerator; - _resourceIdSchemaGenerator = resourceIdSchemaGenerator; - } - - public OpenApiSchema GenerateSchema(ResourceType resourceType, bool forRequestSchema, SchemaRepository schemaRepository) - { - ArgumentNullException.ThrowIfNull(resourceType); - ArgumentNullException.ThrowIfNull(schemaRepository); - - Type resourceIdentifierOpenType = forRequestSchema ? typeof(ResourceIdentifierInRequest<>) : typeof(ResourceIdentifierInResponse<>); - Type resourceIdentifierConstructedType = resourceIdentifierOpenType.MakeGenericType(resourceType.ClrType); - - if (!schemaRepository.TryLookupByType(resourceIdentifierConstructedType, out OpenApiSchema? referenceSchemaForIdentifier)) - { - referenceSchemaForIdentifier = _defaultSchemaGenerator.GenerateSchema(resourceIdentifierConstructedType, schemaRepository); - OpenApiSchema fullSchemaForIdentifier = schemaRepository.Schemas[referenceSchemaForIdentifier.Reference.Id]; - - if (forRequestSchema && !_generationCacheSchemaGenerator.HasAtomicOperationsEndpoint(schemaRepository)) - { - fullSchemaForIdentifier.Properties.Remove(JsonApiPropertyName.Lid); - fullSchemaForIdentifier.Required.Add(JsonApiPropertyName.Id); - } - - SetResourceType(fullSchemaForIdentifier, resourceType, schemaRepository); - SetResourceId(fullSchemaForIdentifier, resourceType, schemaRepository); - } - - return referenceSchemaForIdentifier; - } - - private void SetResourceType(OpenApiSchema fullSchemaForIdentifier, ResourceType resourceType, SchemaRepository schemaRepository) - { - OpenApiSchema referenceSchema = _resourceTypeSchemaGenerator.GenerateSchema(resourceType, schemaRepository); - fullSchemaForIdentifier.Properties[JsonApiPropertyName.Type] = referenceSchema.WrapInExtendedSchema(); - } - - private void SetResourceId(OpenApiSchema fullSchemaForResourceData, ResourceType resourceType, SchemaRepository schemaRepository) - { - OpenApiSchema idSchema = _resourceIdSchemaGenerator.GenerateSchema(resourceType, schemaRepository); - fullSchemaForResourceData.Properties[JsonApiPropertyName.Id] = idSchema; - } -} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs index 6d19280ba2..9feb84c221 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs @@ -1,4 +1,5 @@ using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; @@ -29,9 +30,18 @@ public OpenApiSchema GenerateSchema(ResourceType resourceType, SchemaRepository var fullSchema = new OpenApiSchema { Type = "string", - Enum = [new OpenApiString(resourceType.PublicName)] + Enum = resourceType.ClrType.IsAbstract ? [] : [new OpenApiString(resourceType.PublicName)], + Extensions = + { + [StringEnumOrderingFilter.RequiresSortKey] = new OpenApiBoolean(true) + } }; + foreach (ResourceType derivedType in resourceType.GetAllConcreteDerivedTypes()) + { + fullSchema.Enum.Add(new OpenApiString(derivedType.PublicName)); + } + string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(resourceType); referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); @@ -39,4 +49,32 @@ public OpenApiSchema GenerateSchema(ResourceType resourceType, SchemaRepository return referenceSchema; } + + public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) + { + string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(null); + + if (schemaRepository.Schemas.ContainsKey(schemaId)) + { + return new OpenApiSchema + { + Reference = new OpenApiReference + { + Id = schemaId, + Type = ReferenceType.Schema + } + }; + } + + var fullSchema = new OpenApiSchema + { + Type = "string", + Extensions = + { + [StringEnumOrderingFilter.RequiresSortKey] = new OpenApiBoolean(true) + } + }; + + return schemaRepository.AddDefinition(schemaId, fullSchema); + } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/AtomicOperationsDocumentSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/AtomicOperationsDocumentSchemaGenerator.cs new file mode 100644 index 0000000000..d3a4ec50de --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/AtomicOperationsDocumentSchemaGenerator.cs @@ -0,0 +1,429 @@ +using System.Diagnostics; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Serialization.Objects; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; + +/// +/// Generates the OpenAPI component schema for an atomic:operations request/response document. +/// +internal sealed class AtomicOperationsDocumentSchemaGenerator : DocumentSchemaGenerator +{ + private static readonly Type AtomicOperationAbstractType = typeof(AtomicOperation); + + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly AtomicOperationCodeSchemaGenerator _atomicOperationCodeSchemaGenerator; + private readonly DataSchemaGenerator _dataSchemaGenerator; + private readonly RelationshipIdentifierSchemaGenerator _relationshipIdentifierSchemaGenerator; + private readonly DataContainerSchemaGenerator _dataContainerSchemaGenerator; + private readonly MetaSchemaGenerator _metaSchemaGenerator; + private readonly IAtomicOperationFilter _atomicOperationFilter; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; + private readonly IResourceGraph _resourceGraph; + + public AtomicOperationsDocumentSchemaGenerator(SchemaGenerator defaultSchemaGenerator, + AtomicOperationCodeSchemaGenerator atomicOperationCodeSchemaGenerator, DataSchemaGenerator dataSchemaGenerator, + RelationshipIdentifierSchemaGenerator relationshipIdentifierSchemaGenerator, DataContainerSchemaGenerator dataContainerSchemaGenerator, + MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IAtomicOperationFilter atomicOperationFilter, + JsonApiSchemaIdSelector schemaIdSelector, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, IJsonApiOptions options, + IResourceGraph resourceGraph) + : base(metaSchemaGenerator, linksVisibilitySchemaGenerator, options) + { + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + ArgumentNullException.ThrowIfNull(atomicOperationCodeSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataSchemaGenerator); + ArgumentNullException.ThrowIfNull(relationshipIdentifierSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataContainerSchemaGenerator); + ArgumentNullException.ThrowIfNull(atomicOperationFilter); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _defaultSchemaGenerator = defaultSchemaGenerator; + _atomicOperationCodeSchemaGenerator = atomicOperationCodeSchemaGenerator; + _dataSchemaGenerator = dataSchemaGenerator; + _relationshipIdentifierSchemaGenerator = relationshipIdentifierSchemaGenerator; + _dataContainerSchemaGenerator = dataContainerSchemaGenerator; + _metaSchemaGenerator = metaSchemaGenerator; + _atomicOperationFilter = atomicOperationFilter; + _schemaIdSelector = schemaIdSelector; + _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; + _resourceGraph = resourceGraph; + } + + public override bool CanGenerate(Type schemaType) + { + return schemaType == typeof(OperationsRequestDocument) || schemaType == typeof(OperationsResponseDocument); + } + + protected override OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository) + { + bool isRequestSchema = schemaType == typeof(OperationsRequestDocument); + + if (isRequestSchema) + { + GenerateSchemasForRequestDocument(schemaRepository); + } + else + { + GenerateSchemasForResponseDocument(schemaRepository); + } + + return _defaultSchemaGenerator.GenerateSchema(schemaType, schemaRepository); + } + + private void GenerateSchemasForRequestDocument(SchemaRepository schemaRepository) + { + _ = GenerateSchemaForAbstractOperation(schemaRepository); + + foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes().Where(resourceType => resourceType.BaseType == null)) + { + GenerateSchemaForOperation(resourceType, schemaRepository); + } + } + + private OpenApiSchema GenerateSchemaForAbstractOperation(SchemaRepository schemaRepository) + { + if (schemaRepository.TryLookupByType(AtomicOperationAbstractType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); + + var fullSchema = new OpenApiSchema + { + Type = "object", + Required = new SortedSet([OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName]), + Properties = new Dictionary + { + [OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName] = new() + { + Type = "string" + }, + [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() + }, + AdditionalPropertiesAllowed = false, + Discriminator = new OpenApiDiscriminator + { + PropertyName = OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }, + Extensions = + { + ["x-abstract"] = new OpenApiBoolean(true) + } + }; + + string schemaId = _schemaIdSelector.GetSchemaId(AtomicOperationAbstractType); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(AtomicOperationAbstractType, schemaId); + + return referenceSchema; + } + + private void GenerateSchemaForOperation(ResourceType resourceType, SchemaRepository schemaRepository) + { + GenerateSchemaForResourceOperation(typeof(CreateOperation<>), resourceType, AtomicOperationCode.Add, schemaRepository); + GenerateSchemaForResourceOperation(typeof(UpdateOperation<>), resourceType, AtomicOperationCode.Update, schemaRepository); + GenerateSchemaForResourceOperation(typeof(DeleteOperation<>), resourceType, AtomicOperationCode.Remove, schemaRepository); + + foreach (RelationshipAttribute relationship in GetRelationshipsInTypeHierarchy(resourceType)) + { + if (relationship is HasOneAttribute) + { + GenerateSchemaForRelationshipOperation(typeof(UpdateToOneRelationshipOperation<>), relationship, AtomicOperationCode.Update, schemaRepository); + } + else + { + GenerateSchemaForRelationshipOperation(typeof(AddToRelationshipOperation<>), relationship, AtomicOperationCode.Add, schemaRepository); + GenerateSchemaForRelationshipOperation(typeof(UpdateToManyRelationshipOperation<>), relationship, AtomicOperationCode.Update, schemaRepository); + GenerateSchemaForRelationshipOperation(typeof(RemoveFromRelationshipOperation<>), relationship, AtomicOperationCode.Remove, schemaRepository); + } + } + } + + private void GenerateSchemaForResourceOperation(Type operationOpenType, ResourceType resourceType, AtomicOperationCode operationCode, + SchemaRepository schemaRepository) + { + WriteOperationKind writeOperation = operationCode switch + { + AtomicOperationCode.Add => WriteOperationKind.CreateResource, + AtomicOperationCode.Update => WriteOperationKind.UpdateResource, + AtomicOperationCode.Remove => WriteOperationKind.DeleteResource, + _ => throw new UnreachableException() + }; + + if (IsResourceTypeEnabled(resourceType, writeOperation)) + { + Type operationConstructedType = ChangeResourceTypeInSchemaType(operationOpenType, resourceType); + bool needsEmptyDerivedSchema = resourceType.BaseType != null && _atomicOperationFilter.IsEnabled(resourceType.BaseType, writeOperation); + + if (!needsEmptyDerivedSchema) + { + Type identifierSchemaType = typeof(IdentifierInRequest<>).MakeGenericType(resourceType.ClrType); + _ = _dataSchemaGenerator.GenerateSchema(identifierSchemaType, true, schemaRepository); + + bool hasDataProperty = operationOpenType != typeof(DeleteOperation<>); + + if (hasDataProperty) + { + _ = _dataContainerSchemaGenerator.GenerateSchema(operationConstructedType, resourceType, true, false, schemaRepository); + } + } + + OpenApiSchema referenceSchemaForOperation = _defaultSchemaGenerator.GenerateSchema(operationConstructedType, schemaRepository); + OpenApiSchema fullSchemaForOperation = schemaRepository.Schemas[referenceSchemaForOperation.Reference.Id]; + fullSchemaForOperation.AdditionalPropertiesAllowed = false; + OpenApiSchema inlineSchemaForOperation = fullSchemaForOperation.UnwrapLastExtendedSchema(); + + if (needsEmptyDerivedSchema) + { + Type baseOperationSchemaType = ChangeResourceTypeInSchemaType(operationOpenType, resourceType.BaseType!); + OpenApiSchema referenceSchemaForBaseOperation = schemaRepository.LookupByType(baseOperationSchemaType); + + RemoveProperties(inlineSchemaForOperation); + fullSchemaForOperation.AllOf[0] = referenceSchemaForBaseOperation; + } + else + { + SetOperationCode(inlineSchemaForOperation, operationCode, schemaRepository); + } + + string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, resourceType); + MapInDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); + } + + foreach (ResourceType derivedType in resourceType.DirectlyDerivedTypes) + { + GenerateSchemaForResourceOperation(operationOpenType, derivedType, operationCode, schemaRepository); + } + } + + private bool IsResourceTypeEnabled(ResourceType resourceType, WriteOperationKind writeOperation) + { + return _atomicOperationFilter.IsEnabled(resourceType, writeOperation); + } + + private static Type ChangeResourceTypeInSchemaType(Type schemaOpenType, ResourceType resourceType) + { + return schemaOpenType.MakeGenericType(resourceType.ClrType); + } + + private static void RemoveProperties(OpenApiSchema fullSchema) + { + foreach (string propertyName in fullSchema.Properties.Keys) + { + fullSchema.Properties.Remove(propertyName); + fullSchema.Required.Remove(propertyName); + } + } + + private void SetOperationCode(OpenApiSchema fullSchema, AtomicOperationCode operationCode, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchema = _atomicOperationCodeSchemaGenerator.GenerateSchema(operationCode, schemaRepository); + fullSchema.Properties[JsonApiPropertyName.Op] = referenceSchema.WrapInExtendedSchema(); + } + + private static void MapInDiscriminator(OpenApiSchema referenceSchemaForOperation, string discriminatorValue, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchemaForAbstractOperation = schemaRepository.LookupByType(AtomicOperationAbstractType); + OpenApiSchema fullSchemaForAbstractOperation = schemaRepository.Schemas[referenceSchemaForAbstractOperation.Reference.Id]; + fullSchemaForAbstractOperation.Discriminator.Mapping.Add(discriminatorValue, referenceSchemaForOperation.Reference.ReferenceV3); + } + + private static HashSet GetRelationshipsInTypeHierarchy(ResourceType baseType) + { + HashSet relationships = baseType.Relationships.ToHashSet(); + + if (baseType.IsPartOfTypeHierarchy()) + { + IncludeRelationshipsInDirectlyDerivedTypes(baseType, relationships); + } + + return relationships; + } + + private static void IncludeRelationshipsInDirectlyDerivedTypes(ResourceType baseType, HashSet relationships) + { + foreach (ResourceType derivedType in baseType.DirectlyDerivedTypes) + { + IncludeRelationshipsInDerivedType(derivedType, relationships); + } + } + + private static void IncludeRelationshipsInDerivedType(ResourceType derivedType, HashSet relationships) + { + foreach (RelationshipAttribute relationshipInDerivedType in derivedType.Relationships) + { + relationships.Add(relationshipInDerivedType); + } + + IncludeRelationshipsInDirectlyDerivedTypes(derivedType, relationships); + } + + private void GenerateSchemaForRelationshipOperation(Type operationOpenType, RelationshipAttribute relationship, AtomicOperationCode operationCode, + SchemaRepository schemaRepository) + { + WriteOperationKind writeOperation = operationCode switch + { + AtomicOperationCode.Add => WriteOperationKind.AddToRelationship, + AtomicOperationCode.Update => WriteOperationKind.SetRelationship, + AtomicOperationCode.Remove => WriteOperationKind.RemoveFromRelationship, + _ => throw new UnreachableException() + }; + + if (!IsRelationshipEnabled(relationship, writeOperation)) + { + return; + } + + RelationshipAttribute? relationshipInAnyBaseResourceType = GetRelationshipEnabledInAnyBase(relationship, writeOperation); + + OpenApiSchema? referenceSchemaForRelationshipIdentifier; + + if (relationshipInAnyBaseResourceType == null) + { + Type rightSchemaType = typeof(IdentifierInRequest<>).MakeGenericType(relationship.RightType.ClrType); + _ = _dataSchemaGenerator.GenerateSchema(rightSchemaType, true, schemaRepository); + + referenceSchemaForRelationshipIdentifier = _relationshipIdentifierSchemaGenerator.GenerateSchema(relationship, schemaRepository); + } + else + { + referenceSchemaForRelationshipIdentifier = null; + } + + Type operationConstructedType = ChangeResourceTypeInSchemaType(operationOpenType, relationship.RightType); + _ = _dataContainerSchemaGenerator.GenerateSchema(operationConstructedType, relationship.RightType, true, false, schemaRepository); + + // 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 = _schemaIdSelector.GetRelationshipAtomicOperationSchemaId(relationship, operationCode); + + OpenApiSchema referenceSchemaForOperation = _defaultSchemaGenerator.GenerateSchema(operationConstructedType, schemaRepository); + OpenApiSchema fullSchemaForOperation = schemaRepository.Schemas[referenceSchemaForOperation.Reference.Id]; + fullSchemaForOperation.AdditionalPropertiesAllowed = false; + + OpenApiSchema inlineSchemaForOperation = fullSchemaForOperation.UnwrapLastExtendedSchema(); + SetOperationCode(inlineSchemaForOperation, operationCode, schemaRepository); + + if (referenceSchemaForRelationshipIdentifier != null) + { + inlineSchemaForOperation.Properties[JsonApiPropertyName.Ref] = referenceSchemaForRelationshipIdentifier.WrapInExtendedSchema(); + } + + inlineSchemaForOperation.Properties[JsonApiPropertyName.Data].Nullable = _resourceFieldValidationMetadataProvider.IsNullable(relationship); + + schemaRepository.ReplaceSchemaId(operationConstructedType, schemaId); + referenceSchemaForOperation.Reference.Id = schemaId; + + if (relationshipInAnyBaseResourceType != null) + { + RemoveProperties(inlineSchemaForOperation); + + string baseRelationshipSchemaId = _schemaIdSelector.GetRelationshipAtomicOperationSchemaId(relationshipInAnyBaseResourceType, operationCode); + + if (!schemaRepository.Schemas.ContainsKey(baseRelationshipSchemaId)) + { + throw new UnreachableException(); + } + + fullSchemaForOperation.AllOf[0] = new OpenApiSchema + { + Reference = new OpenApiReference + { + Id = baseRelationshipSchemaId, + Type = ReferenceType.Schema + } + }; + } + + string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, relationship); + MapInDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); + } + + private bool IsRelationshipEnabled(RelationshipAttribute relationship, WriteOperationKind writeOperation) + { + if (!_atomicOperationFilter.IsEnabled(relationship.LeftType, writeOperation)) + { + return false; + } + + if (relationship is HasOneAttribute hasOneRelationship && !IsToOneRelationshipEnabled(hasOneRelationship, writeOperation)) + { + return false; + } + + if (relationship is HasManyAttribute hasManyRelationship && !IsToManyRelationshipEnabled(hasManyRelationship, writeOperation)) + { + return false; + } + + return true; + } + + private static bool IsToOneRelationshipEnabled(HasOneAttribute relationship, WriteOperationKind writeOperation) + { + return writeOperation switch + { + WriteOperationKind.SetRelationship => relationship.Capabilities.HasFlag(HasOneCapabilities.AllowSet), + _ => throw new UnreachableException() + }; + } + + private static bool IsToManyRelationshipEnabled(HasManyAttribute relationship, WriteOperationKind writeOperation) + { + return writeOperation switch + { + WriteOperationKind.SetRelationship => relationship.Capabilities.HasFlag(HasManyCapabilities.AllowSet), + WriteOperationKind.AddToRelationship => relationship.Capabilities.HasFlag(HasManyCapabilities.AllowAdd), + WriteOperationKind.RemoveFromRelationship => relationship.Capabilities.HasFlag(HasManyCapabilities.AllowRemove), + _ => throw new UnreachableException() + }; + } + + private RelationshipAttribute? GetRelationshipEnabledInAnyBase(RelationshipAttribute relationship, WriteOperationKind writeOperation) + { + RelationshipAttribute? relationshipInBaseResourceType = relationship.LeftType.BaseType?.FindRelationshipByPublicName(relationship.PublicName); + + while (relationshipInBaseResourceType != null) + { + if (IsRelationshipEnabled(relationshipInBaseResourceType, writeOperation)) + { + return relationshipInBaseResourceType; + } + + relationshipInBaseResourceType = relationshipInBaseResourceType.LeftType.BaseType?.FindRelationshipByPublicName(relationship.PublicName); + } + + return null; + } + + private void GenerateSchemasForResponseDocument(SchemaRepository schemaRepository) + { + _ = _dataContainerSchemaGenerator.GenerateSchemaForCommonResourceDataInResponse(schemaRepository); + + foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes()) + { + if (IsResourceTypeEnabled(resourceType, WriteOperationKind.CreateResource) || + IsResourceTypeEnabled(resourceType, WriteOperationKind.UpdateResource)) + { + _ = _dataContainerSchemaGenerator.GenerateSchema(typeof(AtomicResult), resourceType, false, false, schemaRepository); + } + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/BodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/DocumentSchemaGenerator.cs similarity index 70% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/BodySchemaGenerator.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/DocumentSchemaGenerator.cs index 28110a36fc..185fb187ea 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/BodySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/DocumentSchemaGenerator.cs @@ -3,18 +3,18 @@ using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; -namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Bodies; +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; /// -/// Generates the OpenAPI component schema for a request and/or response body. +/// Generates the OpenAPI component schema for a request and/or response document. /// -internal abstract class BodySchemaGenerator +internal abstract class DocumentSchemaGenerator { private readonly MetaSchemaGenerator _metaSchemaGenerator; private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; private readonly IJsonApiOptions _options; - protected BodySchemaGenerator(MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, + protected DocumentSchemaGenerator(MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options) { ArgumentNullException.ThrowIfNull(metaSchemaGenerator); @@ -26,31 +26,31 @@ protected BodySchemaGenerator(MetaSchemaGenerator metaSchemaGenerator, LinksVisi _options = options; } - public abstract bool CanGenerate(Type modelType); + public abstract bool CanGenerate(Type schemaType); - public OpenApiSchema GenerateSchema(Type bodyType, SchemaRepository schemaRepository) + public OpenApiSchema GenerateSchema(Type schemaType, SchemaRepository schemaRepository) { - ArgumentNullException.ThrowIfNull(bodyType); + ArgumentNullException.ThrowIfNull(schemaType); ArgumentNullException.ThrowIfNull(schemaRepository); - if (schemaRepository.TryLookupByType(bodyType, out OpenApiSchema? referenceSchema)) + if (schemaRepository.TryLookupByType(schemaType, out OpenApiSchema? referenceSchema)) { return referenceSchema; } _metaSchemaGenerator.GenerateSchema(schemaRepository); - referenceSchema = GenerateBodySchema(bodyType, schemaRepository); + referenceSchema = GenerateDocumentSchema(schemaType, schemaRepository); OpenApiSchema fullSchema = schemaRepository.Schemas[referenceSchema.Reference.Id]; - _linksVisibilitySchemaGenerator.UpdateSchemaForTopLevel(bodyType, fullSchema, schemaRepository); + _linksVisibilitySchemaGenerator.UpdateSchemaForTopLevel(schemaType, fullSchema, schemaRepository); SetJsonApiVersion(fullSchema, schemaRepository); return referenceSchema; } - protected abstract OpenApiSchema GenerateBodySchema(Type bodyType, SchemaRepository schemaRepository); + protected abstract OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository); private void SetJsonApiVersion(OpenApiSchema fullSchema, SchemaRepository schemaRepository) { diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ErrorResponseBodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ErrorResponseDocumentSchemaGenerator.cs similarity index 73% rename from src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ErrorResponseBodySchemaGenerator.cs rename to src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ErrorResponseDocumentSchemaGenerator.cs index 5e61048daa..82aa2ccd27 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ErrorResponseBodySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ErrorResponseDocumentSchemaGenerator.cs @@ -5,17 +5,17 @@ using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; -namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Bodies; +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; /// /// Generates the OpenAPI component schema for an error document. /// -internal sealed class ErrorResponseBodySchemaGenerator : BodySchemaGenerator +internal sealed class ErrorResponseDocumentSchemaGenerator : DocumentSchemaGenerator { private readonly SchemaGenerator _defaultSchemaGenerator; private readonly MetaSchemaGenerator _metaSchemaGenerator; - public ErrorResponseBodySchemaGenerator(SchemaGenerator defaultSchemaGenerator, MetaSchemaGenerator metaSchemaGenerator, + public ErrorResponseDocumentSchemaGenerator(SchemaGenerator defaultSchemaGenerator, MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options) : base(metaSchemaGenerator, linksVisibilitySchemaGenerator, options) { @@ -25,12 +25,12 @@ public ErrorResponseBodySchemaGenerator(SchemaGenerator defaultSchemaGenerator, _metaSchemaGenerator = metaSchemaGenerator; } - public override bool CanGenerate(Type modelType) + public override bool CanGenerate(Type schemaType) { - return modelType == typeof(ErrorResponseDocument); + return schemaType == typeof(ErrorResponseDocument); } - protected override OpenApiSchema GenerateBodySchema(Type bodyType, SchemaRepository schemaRepository) + protected override OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository) { OpenApiSchema referenceSchemaForErrorObject = _defaultSchemaGenerator.GenerateSchema(typeof(ErrorObject), schemaRepository); OpenApiSchema fullSchemaForErrorObject = schemaRepository.Schemas[referenceSchemaForErrorObject.Reference.Id]; @@ -38,6 +38,6 @@ protected override OpenApiSchema GenerateBodySchema(Type bodyType, SchemaReposit OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); fullSchemaForErrorObject.Properties[JsonApiPropertyName.Meta] = referenceSchemaForMeta.WrapInExtendedSchema(); - return _defaultSchemaGenerator.GenerateSchema(bodyType, schemaRepository); + return _defaultSchemaGenerator.GenerateSchema(schemaType, schemaRepository); } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ResourceOrRelationshipDocumentSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ResourceOrRelationshipDocumentSchemaGenerator.cs new file mode 100644 index 0000000000..289e79e0e0 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ResourceOrRelationshipDocumentSchemaGenerator.cs @@ -0,0 +1,85 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; + +/// +/// Generates the OpenAPI component schema for a resource/relationship request/response document. +/// +internal sealed class ResourceOrRelationshipDocumentSchemaGenerator : DocumentSchemaGenerator +{ + private static readonly Type[] RequestDocumentSchemaTypes = + [ + typeof(CreateRequestDocument<>), + typeof(UpdateRequestDocument<>), + typeof(ToOneInRequest<>), + typeof(NullableToOneInRequest<>), + typeof(ToManyInRequest<>) + ]; + + private static readonly Type[] ResponseDocumentSchemaTypes = + [ + typeof(CollectionResponseDocument<>), + typeof(PrimaryResponseDocument<>), + typeof(SecondaryResponseDocument<>), + typeof(NullableSecondaryResponseDocument<>), + typeof(IdentifierResponseDocument<>), + typeof(NullableIdentifierResponseDocument<>), + typeof(IdentifierCollectionResponseDocument<>) + ]; + + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly DataContainerSchemaGenerator _dataContainerSchemaGenerator; + private readonly IResourceGraph _resourceGraph; + + public ResourceOrRelationshipDocumentSchemaGenerator(SchemaGenerator defaultSchemaGenerator, DataContainerSchemaGenerator dataContainerSchemaGenerator, + MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options, + IResourceGraph resourceGraph) + : base(metaSchemaGenerator, linksVisibilitySchemaGenerator, options) + { + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataContainerSchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _defaultSchemaGenerator = defaultSchemaGenerator; + _dataContainerSchemaGenerator = dataContainerSchemaGenerator; + _resourceGraph = resourceGraph; + } + + public override bool CanGenerate(Type schemaType) + { + Type schemaOpenType = schemaType.ConstructedToOpenType(); + return RequestDocumentSchemaTypes.Contains(schemaOpenType) || ResponseDocumentSchemaTypes.Contains(schemaOpenType); + } + + protected override OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(schemaType, out OpenApiSchema? referenceSchemaForDocument)) + { + return referenceSchemaForDocument; + } + + var resourceSchemaType = ResourceSchemaType.Create(schemaType, _resourceGraph); + bool isRequestSchema = RequestDocumentSchemaTypes.Contains(resourceSchemaType.SchemaOpenType); + + _ = _dataContainerSchemaGenerator.GenerateSchema(schemaType, resourceSchemaType.ResourceType, isRequestSchema, !isRequestSchema, schemaRepository); + + referenceSchemaForDocument = _defaultSchemaGenerator.GenerateSchema(schemaType, schemaRepository); + OpenApiSchema inlineSchemaForDocument = schemaRepository.Schemas[referenceSchemaForDocument.Reference.Id].UnwrapLastExtendedSchema(); + + if (JsonApiSchemaFacts.HasNullableDataProperty(resourceSchemaType.SchemaOpenType)) + { + inlineSchemaForDocument.Properties[JsonApiPropertyName.Data].Nullable = true; + } + + return referenceSchemaForDocument; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/GenerationCacheSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/GenerationCacheSchemaGenerator.cs index 043eff295b..e6d4f4c202 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/GenerationCacheSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/GenerationCacheSchemaGenerator.cs @@ -13,8 +13,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; /// internal sealed class GenerationCacheSchemaGenerator { - private const string SchemaId = "__JsonApiSchemaGenerationCache__"; private const string HasAtomicOperationsEndpointPropertyName = "HasAtomicOperationsEndpoint"; + public const string SchemaId = "__JsonApiSchemaGenerationCache__"; private readonly IActionDescriptorCollectionProvider _defaultProvider; private readonly JsonApiEndpointMetadataProvider _jsonApiEndpointMetadataProvider; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/JsonApiSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/JsonApiSchemaGenerator.cs index 743878336a..c05ab19c95 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/JsonApiSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/JsonApiSchemaGenerator.cs @@ -1,8 +1,8 @@ using System.Diagnostics; using System.Reflection; using JsonApiDotNetCore.Controllers; -using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Bodies; using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; @@ -12,30 +12,30 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; internal sealed class JsonApiSchemaGenerator : ISchemaGenerator { private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; - private readonly BodySchemaGenerator[] _bodySchemaGenerators; + private readonly DocumentSchemaGenerator[] _documentSchemaGenerators; - public JsonApiSchemaGenerator(ResourceIdSchemaGenerator resourceIdSchemaGenerator, IEnumerable bodySchemaGenerators) + public JsonApiSchemaGenerator(ResourceIdSchemaGenerator resourceIdSchemaGenerator, IEnumerable documentSchemaGenerators) { ArgumentNullException.ThrowIfNull(resourceIdSchemaGenerator); - ArgumentNullException.ThrowIfNull(bodySchemaGenerators); + ArgumentNullException.ThrowIfNull(documentSchemaGenerators); _resourceIdSchemaGenerator = resourceIdSchemaGenerator; - _bodySchemaGenerators = bodySchemaGenerators as BodySchemaGenerator[] ?? bodySchemaGenerators.ToArray(); + _documentSchemaGenerators = documentSchemaGenerators as DocumentSchemaGenerator[] ?? documentSchemaGenerators.ToArray(); } - public OpenApiSchema GenerateSchema(Type modelType, SchemaRepository schemaRepository, MemberInfo? memberInfo = null, ParameterInfo? parameterInfo = null, + public OpenApiSchema GenerateSchema(Type schemaType, SchemaRepository schemaRepository, MemberInfo? memberInfo = null, ParameterInfo? parameterInfo = null, ApiParameterRouteInfo? routeInfo = null) { - ArgumentNullException.ThrowIfNull(modelType); + ArgumentNullException.ThrowIfNull(schemaType); ArgumentNullException.ThrowIfNull(schemaRepository); if (parameterInfo is { Name: "id" } && IsJsonApiParameter(parameterInfo)) { - return _resourceIdSchemaGenerator.GenerateSchema(modelType, schemaRepository); + return _resourceIdSchemaGenerator.GenerateSchema(schemaType, schemaRepository); } - BodySchemaGenerator schemaGenerator = GetBodySchemaGenerator(modelType); - OpenApiSchema referenceSchema = schemaGenerator.GenerateSchema(modelType, schemaRepository); + DocumentSchemaGenerator schemaGenerator = GetDocumentSchemaGenerator(schemaType); + OpenApiSchema referenceSchema = schemaGenerator.GenerateSchema(schemaType, schemaRepository); if (memberInfo != null || parameterInfo != null) { @@ -52,13 +52,13 @@ private static bool IsJsonApiParameter(ParameterInfo parameter) return parameter.Member.DeclaringType != null && parameter.Member.DeclaringType.IsAssignableTo(typeof(CoreJsonApiController)); } - private BodySchemaGenerator GetBodySchemaGenerator(Type modelType) + private DocumentSchemaGenerator GetDocumentSchemaGenerator(Type schemaType) { - foreach (BodySchemaGenerator bodySchemaGenerator in _bodySchemaGenerators) + foreach (DocumentSchemaGenerator documentSchemaGenerator in _documentSchemaGenerators) { - if (bodySchemaGenerator.CanGenerate(modelType)) + if (documentSchemaGenerator.CanGenerate(schemaType)) { - return bodySchemaGenerator; + return documentSchemaGenerator; } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaRepositoryExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaRepositoryExtensions.cs index a51a8d917a..669c50b4e0 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaRepositoryExtensions.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaRepositoryExtensions.cs @@ -28,6 +28,19 @@ private static FieldInfo GetReservedIdsField() return field; } + public static OpenApiSchema LookupByType(this SchemaRepository schemaRepository, Type schemaType) + { + ArgumentNullException.ThrowIfNull(schemaRepository); + ArgumentNullException.ThrowIfNull(schemaType); + + if (!schemaRepository.TryLookupByType(schemaType, out OpenApiSchema? referenceSchema)) + { + throw new InvalidOperationException($"Reference schema for '{schemaType.Name}' does not exist."); + } + + return referenceSchema; + } + public static void ReplaceSchemaId(this SchemaRepository schemaRepository, Type oldSchemaType, string newSchemaId) { ArgumentNullException.ThrowIfNull(schemaRepository); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs index 9b123606c7..f3ef0d189d 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs @@ -1,8 +1,10 @@ using System.Diagnostics.CodeAnalysis; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; -using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Bodies; using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; using JsonApiDotNetCore.Serialization.Response; using Microsoft.AspNetCore.Mvc; @@ -32,6 +34,10 @@ public static void AddOpenApiForJsonApi(this IServiceCollection services, Action { services.Configure(configureSwaggerGenOptions); } + + services.AddSingleton(); + services.TryAddSingleton(); + services.Replace(ServiceDescriptor.Singleton()); } private static void AddCustomApiExplorer(IServiceCollection services) @@ -71,7 +77,6 @@ private static void AddCustomSwaggerComponents(IServiceCollection services) services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); - services.TryAddSingleton(); } private static void AddSwaggerGenerator(IServiceCollection services) @@ -90,19 +95,16 @@ private static void AddSchemaGenerators(IServiceCollection services) services.TryAddSingleton(); services.TryAddSingleton(); - services.TryAddEnumerable(ServiceDescriptor.Singleton()); - services.TryAddEnumerable(ServiceDescriptor.Singleton()); - services.TryAddEnumerable(ServiceDescriptor.Singleton()); + services.TryAddEnumerable(ServiceDescriptor.Singleton()); + services.TryAddEnumerable(ServiceDescriptor.Singleton()); + services.TryAddEnumerable(ServiceDescriptor.Singleton()); services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); - services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); - services.TryAddSingleton(); - services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SetSchemaTypeToObjectDocumentFilter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SetSchemaTypeToObjectDocumentFilter.cs new file mode 100644 index 0000000000..2764f868e6 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SetSchemaTypeToObjectDocumentFilter.cs @@ -0,0 +1,23 @@ +using JetBrains.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class SetSchemaTypeToObjectDocumentFilter : IDocumentFilter +{ + internal const string RequiresRootObjectTypeKey = "x-requires-root-object-type"; + + public void Apply(OpenApiDocument document, DocumentFilterContext context) + { + foreach (OpenApiSchema schema in document.Components.Schemas.Values) + { + if (schema.Extensions.ContainsKey(RequiresRootObjectTypeKey)) + { + schema.Type = "object"; + schema.Extensions.Remove(RequiresRootObjectTypeKey); + } + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs index a4cdcf07ce..d734828760 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs @@ -12,7 +12,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; internal sealed class ResourceFieldSchemaBuilder { private readonly SchemaGenerator _defaultSchemaGenerator; - private readonly ResourceIdentifierSchemaGenerator _resourceIdentifierSchemaGenerator; + private readonly DataSchemaGenerator _dataSchemaGenerator; private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; private readonly ResourceSchemaType _resourceSchemaType; private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; @@ -22,19 +22,19 @@ internal sealed class ResourceFieldSchemaBuilder private readonly ResourceDocumentationReader _resourceDocumentationReader = new(); private readonly IDictionary _schemasForResourceFields; - public ResourceFieldSchemaBuilder(SchemaGenerator defaultSchemaGenerator, ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, + public ResourceFieldSchemaBuilder(SchemaGenerator defaultSchemaGenerator, DataSchemaGenerator dataSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, RelationshipTypeFactory relationshipTypeFactory, ResourceSchemaType resourceSchemaType) { ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); - ArgumentNullException.ThrowIfNull(resourceIdentifierSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataSchemaGenerator); ArgumentNullException.ThrowIfNull(linksVisibilitySchemaGenerator); ArgumentNullException.ThrowIfNull(resourceSchemaType); ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); ArgumentNullException.ThrowIfNull(relationshipTypeFactory); _defaultSchemaGenerator = defaultSchemaGenerator; - _resourceIdentifierSchemaGenerator = resourceIdentifierSchemaGenerator; + _dataSchemaGenerator = dataSchemaGenerator; _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; _resourceSchemaType = resourceSchemaType; _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; @@ -50,8 +50,8 @@ private IDictionary GetFieldSchemas() referenceSchemaForResource = _defaultSchemaGenerator.GenerateSchema(_resourceSchemaType.ResourceType.ClrType, _resourceSchemaRepository); } - OpenApiSchema fullSchemaForResource = _resourceSchemaRepository.Schemas[referenceSchemaForResource.Reference.Id]; - return fullSchemaForResource.Properties; + OpenApiSchema inlineSchemaForResource = _resourceSchemaRepository.Schemas[referenceSchemaForResource.Reference.Id].UnwrapLastExtendedSchema(); + return inlineSchemaForResource.Properties; } public void SetMembersOfAttributes(OpenApiSchema fullSchemaForAttributes, bool forRequestSchema, SchemaRepository schemaRepository) @@ -108,9 +108,9 @@ public void SetMembersOfAttributes(OpenApiSchema fullSchemaForAttributes, bool f private static AttrCapabilities GetRequiredCapabilityForAttributes(Type resourceDataOpenType) { - return resourceDataOpenType == typeof(ResourceDataInResponse<>) ? AttrCapabilities.AllowView : - resourceDataOpenType == typeof(DataInCreateResourceRequest<>) ? AttrCapabilities.AllowCreate : - resourceDataOpenType == typeof(DataInUpdateResourceRequest<>) ? AttrCapabilities.AllowChange : throw new UnreachableException(); + return resourceDataOpenType == typeof(DataInResponse<>) ? AttrCapabilities.AllowView : + resourceDataOpenType == typeof(DataInCreateRequest<>) ? AttrCapabilities.AllowCreate : + resourceDataOpenType == typeof(DataInUpdateRequest<>) ? AttrCapabilities.AllowChange : throw new UnreachableException(); } private void EnsureAttributeSchemaIsExposed(OpenApiSchema referenceSchemaForAttribute, AttrAttribute attribute, SchemaRepository schemaRepository) @@ -145,7 +145,7 @@ private Type GetRepresentedTypeForAttributeSchema(AttrAttribute attribute) private bool IsFieldRequired(ResourceFieldAttribute field) { - bool isCreateResourceSchemaType = _resourceSchemaType.SchemaOpenType == typeof(DataInCreateResourceRequest<>); + bool isCreateResourceSchemaType = _resourceSchemaType.SchemaOpenType == typeof(DataInCreateRequest<>); return isCreateResourceSchemaType && _resourceFieldValidationMetadataProvider.IsRequired(field); } @@ -161,7 +161,10 @@ public void SetMembersOfRelationships(OpenApiSchema fullSchemaForRelationships, if (matchingRelationship != null) { - _ = _resourceIdentifierSchemaGenerator.GenerateSchema(matchingRelationship.RightType, forRequestSchema, schemaRepository); + Type identifierSchemaOpenType = forRequestSchema ? typeof(IdentifierInRequest<>) : typeof(IdentifierInResponse<>); + Type identifierSchemaConstructedType = identifierSchemaOpenType.MakeGenericType(matchingRelationship.RightType.ClrType); + + _ = _dataSchemaGenerator.GenerateSchema(identifierSchemaConstructedType, forRequestSchema, schemaRepository); AddRelationshipSchemaToResourceData(matchingRelationship, fullSchemaForRelationships, schemaRepository); } } @@ -188,7 +191,7 @@ private void AddRelationshipSchemaToResourceData(RelationshipAttribute relations private Type GetRelationshipSchemaType(RelationshipAttribute relationship, Type openSchemaType) { - bool isResponseSchemaType = openSchemaType.IsAssignableTo(typeof(ResourceDataInResponse<>)); + bool isResponseSchemaType = openSchemaType.IsAssignableTo(typeof(DataInResponse<>)); return isResponseSchemaType ? _relationshipTypeFactory.GetForResponse(relationship) : _relationshipTypeFactory.GetForRequest(relationship); } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs index 24221d2fde..148f0f4e2c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs @@ -9,16 +9,18 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; /// /// Represents a generic component schema type, whose first type parameter implements . Examples: -/// , , -/// , . +/// , , +/// , . /// internal sealed class ResourceSchemaType { + public Type SchemaConstructedType { get; } public Type SchemaOpenType { get; } public ResourceType ResourceType { get; } - private ResourceSchemaType(Type schemaOpenType, ResourceType resourceType) + private ResourceSchemaType(Type schemaConstructedType, Type schemaOpenType, ResourceType resourceType) { + SchemaConstructedType = schemaConstructedType; SchemaOpenType = schemaOpenType; ResourceType = resourceType; } @@ -32,7 +34,15 @@ public static ResourceSchemaType Create(Type schemaConstructedType, IResourceGra Type resourceClrType = schemaConstructedType.GenericTypeArguments[0]; ResourceType resourceType = resourceGraph.GetResourceType(resourceClrType); - return new ResourceSchemaType(schemaOpenType, resourceType); + return new ResourceSchemaType(schemaConstructedType, schemaOpenType, resourceType); + } + + public ResourceSchemaType ChangeResourceType(ResourceType resourceType) + { + ArgumentNullException.ThrowIfNull(resourceType); + + Type schemaConstructedType = SchemaOpenType.MakeGenericType(resourceType.ClrType); + return new ResourceSchemaType(schemaConstructedType, SchemaOpenType, resourceType); } public override string ToString() diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs index e0d32bdcf7..4e2addabb3 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs @@ -1,4 +1,6 @@ +using System.Diagnostics; using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; @@ -12,62 +14,169 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle; [UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] internal sealed class UnusedComponentSchemaCleaner : IDocumentFilter { + private const string ComponentSchemaPrefix = "#/components/schemas/"; + public void Apply(OpenApiDocument document, DocumentFilterContext context) { ArgumentNullException.ThrowIfNull(document); ArgumentNullException.ThrowIfNull(context); - bool hasChanges; + document.Components.Schemas.Remove(GenerationCacheSchemaGenerator.SchemaId); + + HashSet unusedSchemaIds = GetUnusedSchemaIds(document); + AssertNoUnknownSchemasFound(unusedSchemaIds); + + RemoveUnusedComponentSchemas(document, unusedSchemaIds); + } + + private static HashSet GetUnusedSchemaIds(OpenApiDocument document) + { + HashSet reachableSchemaIds = ReachableRootsCollector.Instance.CollectReachableSchemaIds(document); + + ComponentSchemaUsageCollector collector = new(document); + return collector.CollectUnusedSchemaIds(reachableSchemaIds); + } - do + [Conditional("DEBUG")] + private static void AssertNoUnknownSchemasFound(HashSet unusedSchemaIds) + { + if (unusedSchemaIds.Count > 0) { - hasChanges = Cleanup(document); + throw new InvalidOperationException($"Detected unused component schemas: {string.Join(", ", unusedSchemaIds)}"); } - while (hasChanges); } - private static bool Cleanup(OpenApiDocument document) + private static void RemoveUnusedComponentSchemas(OpenApiDocument document, HashSet unusedSchemaIds) { - var visitor = new OpenApiReferenceVisitor(); - var walker = new OpenApiWalker(visitor); - walker.Walk(document); + foreach (string schemaId in unusedSchemaIds) + { + document.Components.Schemas.Remove(schemaId); + } + } - HashSet unusedSchemaNames = []; + private sealed class ReachableRootsCollector + { + public static ReachableRootsCollector Instance { get; } = new(); - foreach (string schemaId in document.Components.Schemas.Select(schema => schema.Key).Where(schemaId => !visitor.UsedSchemaNames.Contains(schemaId))) + private ReachableRootsCollector() { - unusedSchemaNames.Add(schemaId); } - foreach (string schemaId in unusedSchemaNames) + public HashSet CollectReachableSchemaIds(OpenApiDocument document) { - document.Components.Schemas.Remove(schemaId); + ArgumentNullException.ThrowIfNull(document); + + var visitor = new ComponentSchemaReferenceVisitor(); + + var walker = new OpenApiWalker(visitor); + walker.Walk(document); + + return visitor.ReachableSchemaIds; } - return unusedSchemaNames.Count > 0; + private sealed class ComponentSchemaReferenceVisitor : OpenApiVisitorBase + { + public HashSet ReachableSchemaIds { get; } = []; + + public override void Visit(IOpenApiReferenceable referenceable) + { + if (!PathString.StartsWith(ComponentSchemaPrefix, StringComparison.Ordinal)) + { + if (referenceable is OpenApiSchema schema) + { + ReachableSchemaIds.Add(schema.Reference.Id); + } + } + } + } } - private sealed class OpenApiReferenceVisitor : OpenApiVisitorBase + private sealed class ComponentSchemaUsageCollector { - private const string ComponentSchemaPrefix = "#/components/schemas/"; + private readonly IDictionary _componentSchemas; + private readonly HashSet _schemaIdsInUse = []; + + public ComponentSchemaUsageCollector(OpenApiDocument document) + { + ArgumentNullException.ThrowIfNull(document); - public HashSet UsedSchemaNames { get; } = []; + _componentSchemas = document.Components.Schemas; + } - public override void Visit(IOpenApiReferenceable referenceable) + public HashSet CollectUnusedSchemaIds(ICollection reachableSchemaIds) { - UsedSchemaNames.Add(referenceable.Reference.Id); + _schemaIdsInUse.Clear(); + + foreach (string schemaId in reachableSchemaIds) + { + WalkSchemaId(schemaId); + } + + HashSet unusedSchemaIds = _componentSchemas.Keys.ToHashSet(); + unusedSchemaIds.ExceptWith(_schemaIdsInUse); + return unusedSchemaIds; + } + + private void WalkSchemaId(string schemaId) + { + if (_schemaIdsInUse.Add(schemaId)) + { + if (_componentSchemas.TryGetValue(schemaId, out OpenApiSchema? schema)) + { + WalkSchema(schema); + } + } } - public override void Visit(OpenApiSchema schema) + private void WalkSchema(OpenApiSchema? schema) { + if (schema != null) + { + VisitSchema(schema); + + WalkSchema(schema.Items); + WalkSchema(schema.Not); + + foreach (OpenApiSchema? subSchema in schema.AllOf) + { + WalkSchema(subSchema); + } + + foreach (OpenApiSchema? subSchema in schema.AnyOf) + { + WalkSchema(subSchema); + } + + foreach (OpenApiSchema? subSchema in schema.OneOf) + { + WalkSchema(subSchema); + } + + foreach (OpenApiSchema? subSchema in schema.Properties.Values) + { + WalkSchema(subSchema); + } + + // ReSharper disable once TailRecursiveCall + WalkSchema(schema.AdditionalProperties); + } + } + + private void VisitSchema(OpenApiSchema schema) + { + if (schema.Reference is { Type: ReferenceType.Schema, IsExternal: false }) + { + WalkSchemaId(schema.Reference.Id); + } + if (schema.Discriminator != null) { - foreach (string discriminatorValue in schema.Discriminator.Mapping.Values) + foreach (string mappingValue in schema.Discriminator.Mapping.Values) { - if (discriminatorValue.StartsWith(ComponentSchemaPrefix, StringComparison.Ordinal)) + if (mappingValue.StartsWith(ComponentSchemaPrefix, StringComparison.Ordinal)) { - string schemaId = discriminatorValue[ComponentSchemaPrefix.Length..]; - UsedSchemaNames.Add(schemaId); + string schemaId = mappingValue[ComponentSchemaPrefix.Length..]; + WalkSchemaId(schemaId); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs index 9e9027536e..0af2eff72c 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs @@ -46,7 +46,7 @@ public async Task Can_create_resource_with_attributes() Op = AddOperationCode.Add, Data = new DataInCreateTeacherRequest { - Type = TeacherResourceType.Teachers, + Type = ResourceType.Teachers, Attributes = new AttributesInCreateTeacherRequest { Name = newTeacher.Name, @@ -64,13 +64,13 @@ public async Task Can_create_resource_with_attributes() response.Should().NotBeNull(); response.AtomicResults.Should().HaveCount(1); - TeacherDataInResponse teacherDataInResponse = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + DataInTeacherResponse teacherData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; - teacherDataInResponse.Attributes.Should().NotBeNull(); - teacherDataInResponse.Attributes.Name.Should().Be(newTeacher.Name); - teacherDataInResponse.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); - long newTeacherId = long.Parse(teacherDataInResponse.Id!); + long newTeacherId = long.Parse(teacherData.Id!); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -107,7 +107,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Op = AddOperationCode.Add, Data = new DataInCreateEnrollmentRequest { - Type = EnrollmentResourceType.Enrollments, + Type = ResourceType.Enrollments, Attributes = new AttributesInCreateEnrollmentRequest { EnrolledAt = newEnrollment.EnrolledAt @@ -118,7 +118,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingCourse.Id } }, @@ -126,7 +126,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new StudentIdentifierInRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Id = existingStudent.StringId! } } @@ -143,14 +143,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.AtomicResults.Should().HaveCount(1); - EnrollmentDataInResponse enrollmentDataInResponse = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + DataInEnrollmentResponse enrollmentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; - enrollmentDataInResponse.Attributes.Should().NotBeNull(); - enrollmentDataInResponse.Attributes.EnrolledAt.Should().Be((Date)newEnrollment.EnrolledAt); - enrollmentDataInResponse.Attributes.GraduatedAt.Should().BeNull(); - enrollmentDataInResponse.Attributes.HasGraduated.Should().BeFalse(); + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be((Date)newEnrollment.EnrolledAt); + enrollmentData.Attributes.GraduatedAt.Should().BeNull(); + enrollmentData.Attributes.HasGraduated.Should().BeFalse(); - long newEnrollmentId = long.Parse(enrollmentDataInResponse.Id!); + long newEnrollmentId = long.Parse(enrollmentData.Id!); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -181,7 +181,7 @@ public async Task Can_create_resource_with_client_generated_ID() Op = AddOperationCode.Add, Data = new DataInCreateCourseRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = newCourse.Id, Attributes = new AttributesInCreateCourseRequest { diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs index 31961ef38c..3793fc2615 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs @@ -53,7 +53,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Op = RemoveOperationCode.Remove, Ref = new EnrollmentIdentifierInRequest { - Type = EnrollmentResourceType.Enrollments, + Type = ResourceType.Enrollments, Id = existingEnrollment.StringId! } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs index e08d2283bb..cd44911339 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs @@ -54,7 +54,7 @@ public async Task Can_use_local_IDs() Op = AddOperationCode.Add, Data = new DataInCreateTeacherRequest { - Type = TeacherResourceType.Teachers, + Type = ResourceType.Teachers, Lid = teacherLocalId, Attributes = new AttributesInCreateTeacherRequest { @@ -68,7 +68,7 @@ public async Task Can_use_local_IDs() Op = AddOperationCode.Add, Data = new DataInCreateCourseRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = newCourse.Id, Attributes = new AttributesInCreateCourseRequest { @@ -90,7 +90,7 @@ public async Task Can_use_local_IDs() [ new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = newCourse.Id } ] @@ -100,7 +100,7 @@ public async Task Can_use_local_IDs() Op = AddOperationCode.Add, Data = new DataInCreateStudentRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Lid = studentLocalId, Attributes = new AttributesInCreateStudentRequest { @@ -114,7 +114,7 @@ public async Task Can_use_local_IDs() Op = AddOperationCode.Add, Data = new DataInCreateEnrollmentRequest { - Type = EnrollmentResourceType.Enrollments, + Type = ResourceType.Enrollments, Lid = enrollmentLocalId, Attributes = new AttributesInCreateEnrollmentRequest { @@ -126,7 +126,7 @@ public async Task Can_use_local_IDs() { Data = new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = newCourse.Id } }, @@ -134,7 +134,7 @@ public async Task Can_use_local_IDs() { Data = new StudentIdentifierInRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Lid = studentLocalId } } @@ -152,7 +152,7 @@ public async Task Can_use_local_IDs() }, Data = new TeacherIdentifierInRequest { - Type = TeacherResourceType.Teachers, + Type = ResourceType.Teachers, Lid = teacherLocalId } }, @@ -161,7 +161,7 @@ public async Task Can_use_local_IDs() Op = RemoveOperationCode.Remove, Ref = new TeacherIdentifierInRequest { - Type = TeacherResourceType.Teachers, + Type = ResourceType.Teachers, Lid = teacherLocalId } } @@ -176,25 +176,25 @@ public async Task Can_use_local_IDs() response.AtomicResults.Should().HaveCount(7); - TeacherDataInResponse teacherInResponse = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; - teacherInResponse.Attributes.Should().NotBeNull(); - teacherInResponse.Attributes.Name.Should().Be(newTeacher.Name); - teacherInResponse.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); - long newTeacherId = long.Parse(teacherInResponse.Id!); + DataInTeacherResponse teacherData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + long newTeacherId = long.Parse(teacherData.Id!); response.AtomicResults.ElementAt(1).Data.Should().BeNull(); response.AtomicResults.ElementAt(2).Data.Should().BeNull(); - StudentDataInResponse studentInResponse = response.AtomicResults.ElementAt(3).Data.Should().BeOfType().Which; - studentInResponse.Attributes.Should().NotBeNull(); - studentInResponse.Attributes.Name.Should().Be(newStudent.Name); - studentInResponse.Attributes.EmailAddress.Should().Be(newStudent.EmailAddress); - long newStudentId = long.Parse(studentInResponse.Id!); + DataInStudentResponse studentData = response.AtomicResults.ElementAt(3).Data.Should().BeOfType().Which; + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newStudent.EmailAddress); + long newStudentId = long.Parse(studentData.Id!); - EnrollmentDataInResponse enrollmentInResponse = response.AtomicResults.ElementAt(4).Data.Should().BeOfType().Which; - enrollmentInResponse.Attributes.Should().NotBeNull(); - enrollmentInResponse.Attributes.EnrolledAt.Should().Be((Date)newEnrolledAt); - long newEnrollmentId = long.Parse(enrollmentInResponse.Id!); + DataInEnrollmentResponse enrollmentData = response.AtomicResults.ElementAt(4).Data.Should().BeOfType().Which; + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be((Date)newEnrolledAt); + long newEnrollmentId = long.Parse(enrollmentData.Id!); response.AtomicResults.ElementAt(5).Data.Should().BeNull(); response.AtomicResults.ElementAt(6).Data.Should().BeNull(); diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs index cb97361eb7..c07c688252 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs @@ -62,7 +62,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }, Data = new StudentIdentifierInRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Id = existingStudent.StringId! } } @@ -119,12 +119,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingCourses.ElementAt(0).Id }, new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingCourses.ElementAt(1).Id } ] @@ -183,12 +183,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingCourses.ElementAt(0).Id }, new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingCourses.ElementAt(1).Id } ] @@ -246,12 +246,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingTeacher.Teaches.ElementAt(0).Id }, new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingTeacher.Teaches.ElementAt(2).Id } ] diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs index 804e9bd627..c5aca4ec15 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs @@ -59,7 +59,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Op = UpdateOperationCode.Update, Data = new DataInUpdateStudentRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Id = existingStudent.StringId!, Attributes = new AttributesInUpdateStudentRequest { @@ -78,12 +78,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.AtomicResults.Should().HaveCount(1); - StudentDataInResponse studentDataInResponse = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + DataInStudentResponse studentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; - studentDataInResponse.Id.Should().Be(existingStudent.StringId); - studentDataInResponse.Attributes.Should().NotBeNull(); - studentDataInResponse.Attributes.Name.Should().Be(newName); - studentDataInResponse.Attributes.EmailAddress.Should().Be(newEmailAddress); + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newName); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -119,12 +119,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Op = UpdateOperationCode.Update, Ref = new StudentIdentifierInRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Id = existingStudent.StringId! }, Data = new DataInUpdateStudentRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Id = existingStudent.StringId!, Attributes = new AttributesInUpdateStudentRequest { @@ -142,12 +142,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.AtomicResults.Should().HaveCount(1); - StudentDataInResponse studentDataInResponse = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + DataInStudentResponse studentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; - studentDataInResponse.Id.Should().Be(existingStudent.StringId); - studentDataInResponse.Attributes.Should().NotBeNull(); - studentDataInResponse.Attributes.Name.Should().Be(existingStudent.Name); - studentDataInResponse.Attributes.EmailAddress.Should().Be(newEmailAddress); + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(existingStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -188,7 +188,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => Op = UpdateOperationCode.Update, Data = new DataInUpdateEnrollmentRequest { - Type = EnrollmentResourceType.Enrollments, + Type = ResourceType.Enrollments, Id = existingEnrollment.StringId!, Attributes = new AttributesInUpdateEnrollmentRequest { @@ -200,7 +200,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new CourseIdentifierInRequest { - Type = CourseResourceType.Courses, + Type = ResourceType.Courses, Id = existingCourse.Id } }, @@ -208,7 +208,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new StudentIdentifierInRequest { - Type = StudentResourceType.Students, + Type = ResourceType.Students, Id = existingStudent.StringId! } } @@ -225,13 +225,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.AtomicResults.Should().HaveCount(1); - EnrollmentDataInResponse enrollmentDataInResponse = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + DataInEnrollmentResponse enrollmentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; - enrollmentDataInResponse.Id.Should().Be(existingEnrollment.StringId); - enrollmentDataInResponse.Attributes.Should().NotBeNull(); - enrollmentDataInResponse.Attributes.EnrolledAt.Should().Be((Date)newEnrolledAt); - enrollmentDataInResponse.Attributes.GraduatedAt.Should().Be((Date)existingEnrollment.GraduatedAt!.Value); - enrollmentDataInResponse.Attributes.HasGraduated.Should().Be(existingEnrollment.HasGraduated); + enrollmentData.Id.Should().Be(existingEnrollment.StringId); + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be((Date)newEnrolledAt); + enrollmentData.Attributes.GraduatedAt.Should().Be((Date)existingEnrollment.GraduatedAt!.Value); + enrollmentData.Attributes.HasGraduated.Should().Be(existingEnrollment.HasGraduated); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicResult.cs index c4755ce7b2..2904a10156 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicResult.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicResult.cs @@ -19,9 +19,9 @@ public partial class AtomicResult : IBackedModel, IParsable public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse? Data + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } @@ -59,7 +59,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } @@ -71,7 +71,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("data", Data); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCourseResponse.cs similarity index 67% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCourseResponse.cs index 514379b689..df6e6c79e9 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCourseResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class CourseAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInCourseResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -32,32 +28,24 @@ public string? Subject set { BackingStore?.Set("subject", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public CourseAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "subject", n => { Subject = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteStringValue("subject", Subject); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateCourseRequest.cs index f207ad478a..ba7579971a 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateCourseRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateCourseRequest : IBackedModel, IParsable + public partial class AttributesInCreateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -32,20 +28,12 @@ public string? Subject set { BackingStore?.Set("subject", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateCourseRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateCourseRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "subject", n => { Subject = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteStringValue("subject", Subject); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateEnrollmentRequest.cs index 93d1d247f1..40a8d42f00 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateEnrollmentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using Microsoft.Kiota.Abstractions; using System.Collections.Generic; using System.IO; @@ -13,12 +12,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateEnrollmentRequest : IBackedModel, IParsable + public partial class AttributesInCreateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrolledAt property public Date? EnrolledAt { @@ -33,20 +29,12 @@ public Date? GraduatedAt set { BackingStore?.Set("graduatedAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateEnrollmentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest(); @@ -56,9 +44,9 @@ public AttributesInCreateEnrollmentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrolledAt", n => { EnrolledAt = n.GetDateValue(); } }, { "graduatedAt", n => { GraduatedAt = n.GetDateValue(); } }, @@ -69,9 +57,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDateValue("enrolledAt", EnrolledAt); writer.WriteDateValue("graduatedAt", GraduatedAt); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..637d585be2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateStudentRequest.cs index 652cf4ea49..fe38dd276a 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateStudentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateStudentRequest : IBackedModel, IParsable + public partial class AttributesInCreateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The emailAddress property public string? EmailAddress { @@ -32,20 +28,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateStudentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateStudentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("emailAddress", EmailAddress); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateTeacherRequest.cs index bbaf7c3780..892163936d 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateTeacherRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateTeacherRequest : IBackedModel, IParsable + public partial class AttributesInCreateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The emailAddress property public string? EmailAddress { @@ -32,20 +28,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateTeacherRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateTeacherRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("emailAddress", EmailAddress); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInEnrollmentResponse.cs similarity index 70% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInEnrollmentResponse.cs index 8588dfb3ea..d771e3c9ec 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInEnrollmentResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using Microsoft.Kiota.Abstractions; using System.Collections.Generic; using System.IO; @@ -13,12 +12,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class EnrollmentAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInEnrollmentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrolledAt property public Date? EnrolledAt { @@ -40,32 +36,24 @@ public bool? HasGraduated set { BackingStore?.Set("hasGraduated", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public EnrollmentAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrolledAt", n => { EnrolledAt = n.GetDateValue(); } }, { "graduatedAt", n => { GraduatedAt = n.GetDateValue(); } }, @@ -77,9 +65,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDateValue("enrolledAt", EnrolledAt); writer.WriteDateValue("graduatedAt", GraduatedAt); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..b2fa62f1bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInStudentResponse.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInStudentResponse.cs index 56d490af6b..5246f61c11 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInStudentResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TeacherAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInStudentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The emailAddress property public string? EmailAddress { @@ -32,32 +28,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public TeacherAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("emailAddress", EmailAddress); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInTeacherResponse.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInTeacherResponse.cs index 8e39179ec6..be526f6a13 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInTeacherResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class StudentAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInTeacherResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The emailAddress property public string? EmailAddress { @@ -32,32 +28,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public StudentAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("emailAddress", EmailAddress); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateCourseRequest.cs index 13d378c108..4424257f52 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateCourseRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateCourseRequest : IBackedModel, IParsable + public partial class AttributesInUpdateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -32,20 +28,12 @@ public string? Subject set { BackingStore?.Set("subject", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateCourseRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateCourseRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "subject", n => { Subject = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteStringValue("subject", Subject); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateEnrollmentRequest.cs index d80682fa85..94c926c8a7 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateEnrollmentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using Microsoft.Kiota.Abstractions; using System.Collections.Generic; using System.IO; @@ -13,12 +12,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateEnrollmentRequest : IBackedModel, IParsable + public partial class AttributesInUpdateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrolledAt property public Date? EnrolledAt { @@ -33,20 +29,12 @@ public Date? GraduatedAt set { BackingStore?.Set("graduatedAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateEnrollmentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest(); @@ -56,9 +44,9 @@ public AttributesInUpdateEnrollmentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrolledAt", n => { EnrolledAt = n.GetDateValue(); } }, { "graduatedAt", n => { GraduatedAt = n.GetDateValue(); } }, @@ -69,9 +57,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDateValue("enrolledAt", EnrolledAt); writer.WriteDateValue("graduatedAt", GraduatedAt); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..773a8e7ff4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateStudentRequest.cs index 05b27ae464..6617a18ac0 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateStudentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateStudentRequest : IBackedModel, IParsable + public partial class AttributesInUpdateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The emailAddress property public string? EmailAddress { @@ -32,20 +28,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateStudentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateStudentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("emailAddress", EmailAddress); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateTeacherRequest.cs index 502fb40639..a06272523e 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateTeacherRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateTeacherRequest : IBackedModel, IParsable + public partial class AttributesInUpdateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The emailAddress property public string? EmailAddress { @@ -32,20 +28,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateTeacherRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateTeacherRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("emailAddress", EmailAddress); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs index f58bab1d3b..1533147c0e 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class CourseIdentifierInRequest : IBackedModel, IParsable + public partial class CourseIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -32,34 +28,12 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public CourseIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest(); @@ -69,14 +43,12 @@ public CourseIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/CourseDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCourseResponse.cs similarity index 76% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCourseResponse.cs index fbe8b2981c..88d5b209d4 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCourseResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class CourseDataInResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInCourseResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public Guid? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCourseResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCourseResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs index 93bec2f0c4..70c3e9b657 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateCourseRequest : IBackedModel, IParsable + public partial class DataInCreateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreateCourseRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -32,13 +28,6 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest? Relationships { @@ -46,27 +35,12 @@ public Guid? Id set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateCourseRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest(); @@ -76,15 +50,13 @@ public DataInCreateCourseRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 8a5e3e2036..2ed42a7b79 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateEnrollmentRequest : IBackedModel, IParsable + public partial class DataInCreateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreateEnrollmentRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The lid property public string? Lid { @@ -32,13 +28,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest? Relationships { @@ -46,27 +35,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateEnrollmentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest(); @@ -76,15 +50,13 @@ public DataInCreateEnrollmentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 05187c94d7..1dfe2e6f34 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateStudentRequest : IBackedModel, IParsable + public partial class DataInCreateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreateStudentRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The lid property public string? Lid { @@ -32,13 +28,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest? Relationships { @@ -46,27 +35,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateStudentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest(); @@ -76,15 +50,13 @@ public DataInCreateStudentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 8971a5c1be..401be5db98 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateTeacherRequest : IBackedModel, IParsable + public partial class DataInCreateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreateTeacherRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The lid property public string? Lid { @@ -32,13 +28,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest? Relationships { @@ -46,27 +35,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateTeacherRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest(); @@ -76,15 +50,13 @@ public DataInCreateTeacherRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/EnrollmentDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInEnrollmentResponse.cs similarity index 75% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInEnrollmentResponse.cs index 8848b63a9d..d975990b73 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInEnrollmentResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class EnrollmentDataInResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInEnrollmentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInEnrollmentResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInEnrollmentResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInStudentResponse.cs similarity index 76% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInStudentResponse.cs index 7b16b3c6fa..b2f951287c 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInStudentResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class StudentDataInResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInStudentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInStudentResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInStudentResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInTeacherResponse.cs similarity index 76% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInTeacherResponse.cs index 5e781a2199..a18f14d2df 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInTeacherResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TeacherDataInResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInTeacherResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInTeacherResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInTeacherResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs index 36c055044a..dac21081ee 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateCourseRequest : IBackedModel, IParsable + public partial class DataInUpdateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateCourseRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -39,13 +35,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest? Relationships { @@ -53,27 +42,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateCourseRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest(); @@ -83,16 +57,14 @@ public DataInUpdateCourseRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -100,15 +72,14 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 36c164e3c9..ac1c9a49ec 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateEnrollmentRequest : IBackedModel, IParsable + public partial class DataInUpdateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateEnrollmentRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -39,13 +35,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest? Relationships { @@ -53,27 +42,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateEnrollmentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest(); @@ -83,16 +57,14 @@ public DataInUpdateEnrollmentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -100,15 +72,14 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 e5c405ce52..14f92de1ca 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateStudentRequest : IBackedModel, IParsable + public partial class DataInUpdateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateStudentRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -39,13 +35,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest? Relationships { @@ -53,27 +42,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateStudentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest(); @@ -83,16 +57,14 @@ public DataInUpdateStudentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -100,15 +72,14 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 c9e93bddad..6e4c69ea87 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateTeacherRequest : IBackedModel, IParsable + public partial class DataInUpdateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateTeacherRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -39,13 +35,6 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest? Relationships { @@ -53,27 +42,12 @@ public string? Lid set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateTeacherRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest(); @@ -83,16 +57,14 @@ public DataInUpdateTeacherRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -100,15 +72,14 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/EnrollmentIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs index bbe0420670..cf87ae7eaa 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class EnrollmentIdentifierInRequest : IBackedModel, IParsable + public partial class EnrollmentIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public EnrollmentIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest(); @@ -69,14 +43,12 @@ public EnrollmentIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..3c4820a647 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCourseResponse.cs similarity index 74% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCourseResponse.cs index a0cbcf893d..c379e758f8 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCourseResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class CourseRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInCourseResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrollments property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse? Enrollments { @@ -32,32 +28,24 @@ public partial class CourseRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("taughtBy", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public CourseRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse.CreateFromDiscriminatorValue); } }, { "taughtBy", n => { TaughtBy = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInResponse.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("enrollments", Enrollments); writer.WriteObjectValue("taughtBy", TaughtBy); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateCourseRequest.cs index e80fb5581e..3e359c582b 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateCourseRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateCourseRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrollments property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments { @@ -32,20 +28,12 @@ public partial class RelationshipsInCreateCourseRequest : IBackedModel, IParsabl set { BackingStore?.Set("taughtBy", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateCourseRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest(); @@ -55,9 +43,9 @@ public RelationshipsInCreateCourseRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, { "taughtBy", n => { TaughtBy = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("enrollments", Enrollments); writer.WriteObjectValue("taughtBy", TaughtBy); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateEnrollmentRequest.cs index 805fd8e7e3..fbbe4cd5fa 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateEnrollmentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateEnrollmentRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The course property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest? Course { @@ -32,20 +28,12 @@ public partial class RelationshipsInCreateEnrollmentRequest : IBackedModel, IPar set { BackingStore?.Set("student", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateEnrollmentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest(); @@ -55,9 +43,9 @@ public RelationshipsInCreateEnrollmentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "course", n => { Course = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest.CreateFromDiscriminatorValue); } }, { "student", n => { Student = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("course", Course); writer.WriteObjectValue("student", Student); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..2495275ea0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateStudentRequest.cs index 847aeaf80f..ce58511fb7 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateStudentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateStudentRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrollments property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments { @@ -32,20 +28,12 @@ public partial class RelationshipsInCreateStudentRequest : IBackedModel, IParsab set { BackingStore?.Set("mentor", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateStudentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest(); @@ -55,9 +43,9 @@ public RelationshipsInCreateStudentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, { "mentor", n => { Mentor = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("enrollments", Enrollments); writer.WriteObjectValue("mentor", Mentor); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateTeacherRequest.cs index dc53375c9d..4571924fb8 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateTeacherRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateTeacherRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The mentors property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest? Mentors { @@ -32,20 +28,12 @@ public partial class RelationshipsInCreateTeacherRequest : IBackedModel, IParsab set { BackingStore?.Set("teaches", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateTeacherRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest(); @@ -55,9 +43,9 @@ public RelationshipsInCreateTeacherRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "mentors", n => { Mentors = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest.CreateFromDiscriminatorValue); } }, { "teaches", n => { Teaches = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("mentors", Mentors); writer.WriteObjectValue("teaches", Teaches); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInEnrollmentResponse.cs similarity index 73% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInEnrollmentResponse.cs index 33b475c28a..4de0b551e2 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInEnrollmentResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class EnrollmentRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInEnrollmentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The course property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInResponse? Course { @@ -32,32 +28,24 @@ public partial class EnrollmentRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("student", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public EnrollmentRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "course", n => { Course = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInResponse.CreateFromDiscriminatorValue); } }, { "student", n => { Student = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInResponse.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("course", Course); writer.WriteObjectValue("student", Student); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..6902dedf96 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInStudentResponse.cs similarity index 74% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInStudentResponse.cs index 6db1f8b16d..fe1560af47 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInStudentResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class StudentRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInStudentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrollments property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse? Enrollments { @@ -32,32 +28,24 @@ public partial class StudentRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("mentor", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public StudentRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse.CreateFromDiscriminatorValue); } }, { "mentor", n => { Mentor = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInResponse.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("enrollments", Enrollments); writer.WriteObjectValue("mentor", Mentor); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInTeacherResponse.cs similarity index 74% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInTeacherResponse.cs index 09a22e6f81..aa2a9666db 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInTeacherResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TeacherRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInTeacherResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The mentors property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInResponse? Mentors { @@ -32,32 +28,24 @@ public partial class TeacherRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("teaches", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public TeacherRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "mentors", n => { Mentors = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInResponse.CreateFromDiscriminatorValue); } }, { "teaches", n => { Teaches = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInResponse.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("mentors", Mentors); writer.WriteObjectValue("teaches", Teaches); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateCourseRequest.cs index a30aabe9bf..fcec16798b 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateCourseRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateCourseRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrollments property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments { @@ -32,20 +28,12 @@ public partial class RelationshipsInUpdateCourseRequest : IBackedModel, IParsabl set { BackingStore?.Set("taughtBy", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateCourseRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest(); @@ -55,9 +43,9 @@ public RelationshipsInUpdateCourseRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, { "taughtBy", n => { TaughtBy = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("enrollments", Enrollments); writer.WriteObjectValue("taughtBy", TaughtBy); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateEnrollmentRequest.cs index 94d2a87523..4902edd159 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateEnrollmentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateEnrollmentRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The course property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest? Course { @@ -32,20 +28,12 @@ public partial class RelationshipsInUpdateEnrollmentRequest : IBackedModel, IPar set { BackingStore?.Set("student", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateEnrollmentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest(); @@ -55,9 +43,9 @@ public RelationshipsInUpdateEnrollmentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "course", n => { Course = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest.CreateFromDiscriminatorValue); } }, { "student", n => { Student = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("course", Course); writer.WriteObjectValue("student", Student); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..72224b3a16 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateStudentRequest.cs index 1874fde689..b2b4fde160 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateStudentRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateStudentRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The enrollments property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments { @@ -32,20 +28,12 @@ public partial class RelationshipsInUpdateStudentRequest : IBackedModel, IParsab set { BackingStore?.Set("mentor", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateStudentRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest(); @@ -55,9 +43,9 @@ public RelationshipsInUpdateStudentRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, { "mentor", n => { Mentor = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("enrollments", Enrollments); writer.WriteObjectValue("mentor", Mentor); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateTeacherRequest.cs index abc7379aec..a2e503c4ca 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateTeacherRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateTeacherRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The mentors property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest? Mentors { @@ -32,20 +28,12 @@ public partial class RelationshipsInUpdateTeacherRequest : IBackedModel, IParsab set { BackingStore?.Set("teaches", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateTeacherRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest(); @@ -55,9 +43,9 @@ public RelationshipsInUpdateTeacherRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "mentors", n => { Mentors = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest.CreateFromDiscriminatorValue); } }, { "teaches", n => { Teaches = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("mentors", Mentors); writer.WriteObjectValue("teaches", Teaches); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..5ac8dbd672 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInResponse.cs similarity index 85% rename from test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInResponse.cs index 68da6e2fe7..770c825f12 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInResponse.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class ResourceInResponse : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public ResourceInResponse() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,19 +43,19 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseDataInResponse(), - "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentDataInResponse(), - "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentDataInResponse(), - "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherDataInResponse(), - _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInResponse(), + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCourseResponse(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInEnrollmentResponse(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInStudentResponse(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInTeacherResponse(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse(), }; } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..bf38a35f4c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs index b7ddb8034b..ca44dd2749 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class StudentIdentifierInRequest : IBackedModel, IParsable + public partial class StudentIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public StudentIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest(); @@ -69,14 +43,12 @@ public StudentIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/TeacherIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs index e8027cc2fb..04be63b9a9 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TeacherIdentifierInRequest : IBackedModel, IParsable + public partial class TeacherIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Lid set { BackingStore?.Set("lid", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public TeacherIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest(); @@ -69,14 +43,12 @@ public TeacherIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs index 83c47445bc..7ba9ad8e64 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -75,8 +75,8 @@ public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndT _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); return requestInfo; } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs index 811c137367..d22e9e8cc2 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs @@ -42,7 +42,7 @@ public async Task Cannot_create_resource_without_ID_when_supplying_ID_is_require { Data = new DataInCreatePlayerRequest { - Type = PlayerResourceType.Players, + Type = ResourceType.Players, Attributes = new AttributesInCreatePlayerRequest { UserName = newPlayer.UserName @@ -81,7 +81,7 @@ public async Task Can_create_resource_with_ID_when_supplying_ID_is_required() { Data = new DataInCreatePlayerRequest { - Type = PlayerResourceType.Players, + Type = ResourceType.Players, Id = newPlayer.Id, Attributes = new AttributesInCreatePlayerRequest { @@ -91,7 +91,7 @@ public async Task Can_create_resource_with_ID_when_supplying_ID_is_required() }; // Act - PlayerPrimaryResponseDocument? response = await apiClient.Players.PostAsync(requestBody); + PrimaryPlayerResponseDocument? response = await apiClient.Players.PostAsync(requestBody); // Assert response.Should().BeNull(); @@ -117,7 +117,7 @@ public async Task Can_create_resource_without_ID_when_supplying_ID_is_allowed() { Data = new DataInCreateGameRequest { - Type = GameResourceType.Games, + Type = ResourceType.Games, Attributes = new AttributesInCreateGameRequest { Title = newGame.Title, @@ -127,7 +127,7 @@ public async Task Can_create_resource_without_ID_when_supplying_ID_is_allowed() }; // Act - GamePrimaryResponseDocument? response = await apiClient.Games.PostAsync(requestBody); + PrimaryGameResponseDocument? response = await apiClient.Games.PostAsync(requestBody); // Assert response.Should().NotBeNull(); @@ -158,7 +158,7 @@ public async Task Can_create_resource_with_ID_when_supplying_ID_is_allowed() { Data = new DataInCreateGameRequest { - Type = GameResourceType.Games, + Type = ResourceType.Games, Id = newGame.Id, Attributes = new AttributesInCreateGameRequest { @@ -169,7 +169,7 @@ public async Task Can_create_resource_with_ID_when_supplying_ID_is_allowed() }; // Act - GamePrimaryResponseDocument? response = await apiClient.Games.PostAsync(requestBody); + PrimaryGameResponseDocument? response = await apiClient.Games.PostAsync(requestBody); // Assert response.Should().BeNull(); @@ -202,7 +202,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataInCreateGameRequest { - Type = GameResourceType.Games, + Type = ResourceType.Games, Id = existingGame.Id, Attributes = new AttributesInCreateGameRequest { @@ -240,7 +240,7 @@ public async Task Can_create_resource_without_ID_when_supplying_ID_is_forbidden( { Data = new DataInCreatePlayerGroupRequest { - Type = PlayerGroupResourceType.PlayerGroups, + Type = ResourceType.PlayerGroups, Attributes = new AttributesInCreatePlayerGroupRequest { Name = newPlayerGroup.Name @@ -249,7 +249,7 @@ public async Task Can_create_resource_without_ID_when_supplying_ID_is_forbidden( }; // Act - PlayerGroupPrimaryResponseDocument? response = await apiClient.PlayerGroups.PostAsync(requestBody); + PrimaryPlayerGroupResponseDocument? response = await apiClient.PlayerGroups.PostAsync(requestBody); // Assert response.Should().NotBeNull(); diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Games/GamesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Games/GamesRequestBuilder.cs index 825f3e0380..9c43818ad9 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Games/GamesRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Games/GamesRequestBuilder.cs @@ -40,7 +40,7 @@ public GamesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base /// /// Creates a new game. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -48,7 +48,7 @@ public GamesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base /// When receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreateGameRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreateGameRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -59,7 +59,7 @@ public GamesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base { "409", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "422", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GamePrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryGameResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -73,8 +73,8 @@ public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndT _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); return requestInfo; } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateGameRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateGameRequest.cs index 4c70562f6b..81b6dad5b4 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateGameRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateGameRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateGameRequest : IBackedModel, IParsable + public partial class AttributesInCreateGameRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The purchasePrice property public double? PurchasePrice { @@ -32,20 +28,12 @@ public string? Title set { BackingStore?.Set("title", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateGameRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateGameRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "purchasePrice", n => { PurchasePrice = n.GetDoubleValue(); } }, { "title", n => { Title = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDoubleValue("purchasePrice", PurchasePrice); writer.WriteStringValue("title", Title); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerGroupRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerGroupRequest.cs index 55f2ac15b9..a0890d42e0 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerGroupRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerGroupRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreatePlayerGroupRequest : IBackedModel, IParsable + public partial class AttributesInCreatePlayerGroupRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -25,20 +21,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreatePlayerGroupRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest(); @@ -48,9 +36,9 @@ public AttributesInCreatePlayerGroupRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerRequest.cs index f8c0341281..0e08fbe104 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreatePlayerRequest : IBackedModel, IParsable + public partial class AttributesInCreatePlayerRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The userName property public string? UserName { @@ -25,20 +21,12 @@ public string? UserName set { BackingStore?.Set("userName", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreatePlayerRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest(); @@ -48,9 +36,9 @@ public AttributesInCreatePlayerRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "userName", n => { UserName = n.GetStringValue(); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("userName", UserName); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..5661aa5ced --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInGameResponse.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInGameResponse.cs index cb9753583a..83699cbc7c 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInGameResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class GameAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInGameResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The purchasePrice property public double? PurchasePrice { @@ -32,32 +28,24 @@ public string? Title set { BackingStore?.Set("title", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public GameAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "purchasePrice", n => { PurchasePrice = n.GetDoubleValue(); } }, { "title", n => { Title = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDoubleValue("purchasePrice", PurchasePrice); writer.WriteStringValue("title", Title); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerGroupResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerGroupResponse.cs new file mode 100644 index 0000000000..07adaf6403 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerGroupResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInPlayerGroupResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerResponse.cs new file mode 100644 index 0000000000..e23122f9dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInPlayerResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The userName property + public string? UserName + { + get { return BackingStore?.Get("userName"); } + set { BackingStore?.Set("userName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "userName", n => { UserName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("userName", UserName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..e56ce8d295 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs index 22d3cbdfaa..b9c39a55b6 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateGameRequest : IBackedModel, IParsable + public partial class DataInCreateGameRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreateGameRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -32,34 +28,12 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateGameRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest(); @@ -69,14 +43,12 @@ public DataInCreateGameRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 d7cda5c1a6..273cdc05f9 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreatePlayerGroupRequest : IBackedModel, IParsable + public partial class DataInCreatePlayerGroupRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,16 +21,6 @@ public partial class DataInCreatePlayerGroupRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest? Relationships { @@ -39,27 +28,12 @@ public partial class DataInCreatePlayerGroupRequest : IBackedModel, IParsable set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreatePlayerGroupRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest(); @@ -69,14 +43,12 @@ public DataInCreatePlayerGroupRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 316a286f95..674f245d09 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreatePlayerRequest : IBackedModel, IParsable + public partial class DataInCreatePlayerRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInCreatePlayerRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -32,13 +28,6 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest? Relationships { @@ -46,27 +35,12 @@ public Guid? Id set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreatePlayerRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest(); @@ -76,15 +50,13 @@ public DataInCreatePlayerRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/GameDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInGameResponse.cs similarity index 81% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInGameResponse.cs index f1d16175c8..f4dfd7903c 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInGameResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class GameDataInResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInGameResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -38,12 +38,12 @@ public Guid? Id /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse(); } /// @@ -54,7 +54,7 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, }; @@ -68,7 +68,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerGroupResponse.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerGroupResponse.cs index 67425fb7c7..4f340d6718 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerGroupResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerGroupDataInResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInPlayerGroupResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerResponse.cs similarity index 76% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerResponse.cs index 32f7a80f60..cf01cc0cb9 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerDataInResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInPlayerResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public Guid? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs index b0e6da44f8..ebb12863b6 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class GameIdentifierInRequest : IBackedModel, IParsable + public partial class GameIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -25,34 +21,12 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public GameIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest(); @@ -62,13 +36,11 @@ public GameIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetGuidValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteGuidValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/IdentifierInRequest.cs similarity index 86% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/IdentifierInRequest.cs index 4615332064..da6c488aca 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/IdentifierInRequest.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class IdentifierInRequest : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public IdentifierInRequest() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,18 +43,18 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameDataInResponse(), - "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupDataInResponse(), - "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerDataInResponse(), - _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse(), + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest(), }; } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs index 9b6950ab72..ac6196074a 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerGroupIdentifierInRequest : IBackedModel, IParsable + public partial class PlayerGroupIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -25,34 +21,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public PlayerGroupIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest(); @@ -62,13 +36,11 @@ public PlayerGroupIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetStringValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 8df93fd54b..ad41f6900e 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerIdentifierInRequest : IBackedModel, IParsable + public partial class PlayerIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -25,34 +21,12 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public PlayerIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest(); @@ -62,13 +36,11 @@ public PlayerIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetGuidValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteGuidValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GamePrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryGameResponseDocument.cs similarity index 81% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GamePrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryGameResponseDocument.cs index 5b0eaf8565..eb87b15731 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GamePrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryGameResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class GamePrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryGameResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class GamePrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public GamePrimaryResponseDocument() + public PrimaryGameResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public GamePrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GamePrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryGameResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GamePrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryGameResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerGroupResponseDocument.cs similarity index 79% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerGroupResponseDocument.cs index c18c1e4acb..ebb52b48cd 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerGroupResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerGroupPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryPlayerGroupResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class PlayerGroupPrimaryResponseDocument : IBackedModel, IParsabl } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public PlayerGroupPrimaryResponseDocument() + public PrimaryPlayerGroupResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public PlayerGroupPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerGroupResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerGroupResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerResponseDocument.cs similarity index 81% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerResponseDocument.cs index 05050a9b55..86ba7e7572 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryPlayerResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class PlayerPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public PlayerPrimaryResponseDocument() + public PrimaryPlayerResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public PlayerPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerGroupRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerGroupRequest.cs index b17521dbdb..ac7620c563 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerGroupRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerGroupRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreatePlayerGroupRequest : IBackedModel, IParsable + public partial class RelationshipsInCreatePlayerGroupRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The players property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInRequest? Players { @@ -25,20 +21,12 @@ public partial class RelationshipsInCreatePlayerGroupRequest : IBackedModel, IPa set { BackingStore?.Set("players", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreatePlayerGroupRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest(); @@ -48,9 +36,9 @@ public RelationshipsInCreatePlayerGroupRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "players", n => { Players = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInRequest.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("players", Players); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerRequest.cs index 289b03873a..9ebc8c4db9 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreatePlayerRequest : IBackedModel, IParsable + public partial class RelationshipsInCreatePlayerRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The memberOf property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInRequest? MemberOf { @@ -32,20 +28,12 @@ public partial class RelationshipsInCreatePlayerRequest : IBackedModel, IParsabl set { BackingStore?.Set("ownedGames", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreatePlayerRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest(); @@ -55,9 +43,9 @@ public RelationshipsInCreatePlayerRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "memberOf", n => { MemberOf = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInRequest.CreateFromDiscriminatorValue); } }, { "ownedGames", n => { OwnedGames = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInRequest.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("memberOf", MemberOf); writer.WriteObjectValue("ownedGames", OwnedGames); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..7be2a2fe20 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerGroupResponse.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerGroupResponse.cs index 59cabdde4d..289181d405 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerGroupResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerGroupRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInPlayerGroupResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The players property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInResponse? Players { @@ -25,32 +21,24 @@ public partial class PlayerGroupRelationshipsInResponse : IBackedModel, IParsabl set { BackingStore?.Set("players", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public PlayerGroupRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "players", n => { Players = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInResponse.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("players", Players); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerResponse.cs similarity index 73% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerResponse.cs index 561d94d771..15bff75fb5 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInPlayerResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The memberOf property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInResponse? MemberOf { @@ -32,32 +28,24 @@ public partial class PlayerRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("ownedGames", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public PlayerRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "memberOf", n => { MemberOf = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInResponse.CreateFromDiscriminatorValue); } }, { "ownedGames", n => { OwnedGames = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInResponse.CreateFromDiscriminatorValue); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("memberOf", MemberOf); writer.WriteObjectValue("ownedGames", OwnedGames); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..437b617413 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..d088941ea4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..422dc8da2f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/PlayerGroups/PlayerGroupsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/PlayerGroups/PlayerGroupsRequestBuilder.cs index 459721e7e3..c7ba47a086 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/PlayerGroups/PlayerGroupsRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/PlayerGroups/PlayerGroupsRequestBuilder.cs @@ -40,7 +40,7 @@ public PlayerGroupsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) /// /// Creates a new playerGroup. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -49,7 +49,7 @@ public PlayerGroupsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) /// When receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerGroupRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerGroupRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -61,7 +61,7 @@ public PlayerGroupsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) { "409", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "422", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerGroupResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -75,8 +75,8 @@ public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndT _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); return requestInfo; } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Players/PlayersRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Players/PlayersRequestBuilder.cs index db0b471772..f88f040c6e 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Players/PlayersRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Players/PlayersRequestBuilder.cs @@ -40,7 +40,7 @@ public PlayersRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : ba /// /// Creates a new player. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -48,7 +48,7 @@ public PlayersRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : ba /// When receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -59,7 +59,7 @@ public PlayersRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : ba { "409", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "422", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -73,8 +73,8 @@ public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndT _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); return requestInfo; } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/ETagTests.cs b/test/OpenApiKiotaEndToEndTests/Headers/ETagTests.cs index cab06d306d..0020d1d174 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/ETagTests.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/ETagTests.cs @@ -139,7 +139,7 @@ public async Task Returns_no_ETag_for_POST_request() { Data = new DataInCreateCountryRequest { - Type = CountryResourceType.Countries, + Type = ResourceType.Countries, Attributes = new AttributesInCreateCountryRequest { Name = newCountry.Name, @@ -149,7 +149,7 @@ public async Task Returns_no_ETag_for_POST_request() }; // Act - CountryPrimaryResponseDocument? response = + PrimaryCountryResponseDocument? response = await apiClient.Countries.PostAsync(requestBody, configuration => configuration.Options.Add(headerInspector)); // Assert diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/CountriesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/CountriesRequestBuilder.cs index cfe82f7af6..806b7443ab 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/CountriesRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/CountriesRequestBuilder.cs @@ -82,7 +82,7 @@ public async Task HeadAsync(Action /// Creates a new country. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CreateCountryRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CreateCountryRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual country by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -83,7 +83,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -100,7 +100,7 @@ public async Task HeadAsync(Action /// Updates an existing country. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -108,7 +108,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.UpdateCountryRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.UpdateCountryRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -119,7 +119,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -131,7 +131,7 @@ public RequestInformation ToDeleteRequestInformation(ActionStores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -32,32 +28,24 @@ public long? Population set { BackingStore?.Set("population", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public CountryAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, { "population", n => { Population = n.GetLongValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); writer.WriteLongValue("population", Population); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateCountryRequest.cs index e3806c61dd..6b7377a82c 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateCountryRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateCountryRequest : IBackedModel, IParsable + public partial class AttributesInCreateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -32,20 +28,12 @@ public long? Population set { BackingStore?.Set("population", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateCountryRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateCountryRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, { "population", n => { Population = n.GetLongValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); writer.WriteLongValue("population", Population); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..14dbfd1efb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInLanguageResponse.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInLanguageResponse.cs index 57a6639443..32d71abd9e 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInLanguageResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class LanguageAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInLanguageResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The code property public string? Code { @@ -32,32 +28,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public LanguageAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "code", n => { Code = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("code", Code); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..496a044efd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse(), + "languages" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateCountryRequest.cs index 64aadc4722..9b2f761daf 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateCountryRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateCountryRequest : IBackedModel, IParsable + public partial class AttributesInUpdateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -32,20 +28,12 @@ public long? Population set { BackingStore?.Set("population", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateCountryRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateCountryRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, { "population", n => { Population = n.GetLongValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); writer.WriteLongValue("population", Population); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..6fd015c7a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs index 8d4d19d31f..af711e741b 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class CountryCollectionResponseDocument : IBackedModel, IParsable public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCountryResponse.cs similarity index 81% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCountryResponse.cs index 14dc3018f8..2712a0367a 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCountryResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class CountryDataInResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInCountryResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public Guid? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs index 070bb35a22..7ce74c8b3d 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateCountryRequest : IBackedModel, IParsable + public partial class DataInCreateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,16 +21,6 @@ public partial class DataInCreateCountryRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest? Relationships { @@ -39,27 +28,12 @@ public partial class DataInCreateCountryRequest : IBackedModel, IParsable set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateCountryRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest(); @@ -69,14 +43,12 @@ public DataInCreateCountryRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/LanguageDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInLanguageResponse.cs similarity index 84% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInLanguageResponse.cs index 0ca481303d..fb9e4a1a67 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInLanguageResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class LanguageDataInResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInLanguageResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -38,12 +38,12 @@ public Guid? Id /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse(); } /// @@ -54,7 +54,7 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, }; @@ -68,7 +68,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs index 146c190099..38bcdbfc4e 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateCountryRequest : IBackedModel, IParsable + public partial class DataInUpdateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateCountryRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -32,13 +28,6 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest? Relationships { @@ -46,27 +35,12 @@ public Guid? Id set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateCountryRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest(); @@ -76,15 +50,13 @@ public DataInUpdateCountryRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..e84a79dd0b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "languages" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs index bad7251994..96fda5b57a 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class LanguageCollectionResponseDocument : IBackedModel, IParsabl public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); 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 d04b082503..c1fbd8c800 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class LanguageIdentifierInRequest : IBackedModel, IParsable + public partial class LanguageIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -25,34 +21,12 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public LanguageIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest(); @@ -62,13 +36,11 @@ public LanguageIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetGuidValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteGuidValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/PrimaryCountryResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/PrimaryCountryResponseDocument.cs index 3ab961e9e2..0f01d96dc2 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/PrimaryCountryResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class CountryPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryCountryResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class CountryPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public CountryPrimaryResponseDocument() + public PrimaryCountryResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public CountryPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCountryResponse.cs similarity index 67% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCountryResponse.cs index b83ef575a4..ad553a7e9b 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCountryResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class CountryRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInCountryResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The languages property public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInResponse? Languages { @@ -25,32 +21,24 @@ public partial class CountryRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("languages", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public CountryRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "languages", n => { Languages = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInResponse.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("languages", Languages); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateCountryRequest.cs index 6e5c180f90..420df477b8 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateCountryRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateCountryRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The languages property public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest? Languages { @@ -25,20 +21,12 @@ public partial class RelationshipsInCreateCountryRequest : IBackedModel, IParsab set { BackingStore?.Set("languages", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateCountryRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest(); @@ -48,9 +36,9 @@ public RelationshipsInCreateCountryRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "languages", n => { Languages = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("languages", Languages); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..2bc115a97e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..79baa9aa61 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateCountryRequest.cs index 5ee5bb87a9..534b24bdf8 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateCountryRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateCountryRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The languages property public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest? Languages { @@ -25,20 +21,12 @@ public partial class RelationshipsInUpdateCountryRequest : IBackedModel, IParsab set { BackingStore?.Set("languages", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateCountryRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest(); @@ -48,9 +36,9 @@ public RelationshipsInUpdateCountryRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "languages", n => { Languages = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("languages", Languages); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..eac5fe2ed1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..b5cf81cd00 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInResponse.cs similarity index 87% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInResponse.cs index aa5e0a498d..8cbdaf46ed 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInResponse.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class ResourceInResponse : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public ResourceInResponse() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,17 +43,17 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryDataInResponse(), - "languages" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageDataInResponse(), - _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInResponse(), + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse(), + "languages" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse(), }; } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..09f5c48d1a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/HeaderTests.cs b/test/OpenApiKiotaEndToEndTests/Headers/HeaderTests.cs index 4a18a0ebeb..b42071a6af 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/HeaderTests.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/HeaderTests.cs @@ -44,7 +44,7 @@ public async Task Returns_Location_for_post_resource_request() { Data = new DataInCreateCountryRequest { - Type = CountryResourceType.Countries, + Type = ResourceType.Countries, Attributes = new AttributesInCreateCountryRequest { Name = newCountry.Name, @@ -54,7 +54,7 @@ public async Task Returns_Location_for_post_resource_request() }; // Act - CountryPrimaryResponseDocument? response = + PrimaryCountryResponseDocument? response = await apiClient.Countries.PostAsync(requestBody, configuration => configuration.Options.Add(headerInspector)); // Assert diff --git a/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs b/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs index fff4de85ae..b27fbf28fe 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs @@ -45,7 +45,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - ExcursionPrimaryResponseDocument? response = await apiClient.Excursions[excursion.StringId!].GetAsync(); + PrimaryExcursionResponseDocument? response = await apiClient.Excursions[excursion.StringId!].GetAsync(); // Assert response.Should().NotBeNull(); diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs index bc08cab3e4..0e9bc39d41 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs @@ -82,7 +82,7 @@ public async Task HeadAsync(Action /// Creates a new accommodation. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateAccommodationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateAccommodationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual accommodation by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -69,7 +69,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -86,7 +86,7 @@ public async Task HeadAsync(Action /// Updates an existing accommodation. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -94,7 +94,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateAccommodationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateAccommodationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -105,7 +105,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -117,7 +117,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Creates a new excursion. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateExcursionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateExcursionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual excursion by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -69,7 +69,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -86,7 +86,7 @@ public async Task HeadAsync(Action /// Updates an existing excursion. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -94,7 +94,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateExcursionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateExcursionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -105,7 +105,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -117,7 +117,7 @@ public RequestInformation ToDeleteRequestInformation(ActionThe data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); 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 e78612e5a8..aae4d490d4 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AccommodationIdentifierInRequest : IBackedModel, IParsable + public partial class AccommodationIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -25,34 +21,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public AccommodationIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest(); @@ -62,13 +36,11 @@ public AccommodationIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetStringValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInAccommodationResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInAccommodationResponse.cs new file mode 100644 index 0000000000..08015788a2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInAccommodationResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInAccommodationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The address property + public string? Address + { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "address", n => { Address = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("address", Address); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateAccommodationRequest.cs index 56df41574a..99ccaec809 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateAccommodationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateAccommodationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateAccommodationRequest : IBackedModel, IParsable + public partial class AttributesInCreateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { /// The address property @@ -22,23 +21,12 @@ public string? Address set { BackingStore?.Set("address", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateAccommodationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest(); @@ -48,9 +36,9 @@ public AttributesInCreateAccommodationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "address", n => { Address = n.GetStringValue(); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("address", Address); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateExcursionRequest.cs index 4bf8fe7ff7..2479302ede 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateExcursionRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateExcursionRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateExcursionRequest : IBackedModel, IParsable + public partial class AttributesInCreateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -32,20 +28,12 @@ public DateTimeOffset? OccursAt set { BackingStore?.Set("occursAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateExcursionRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateExcursionRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteDateTimeOffsetValue("occursAt", OccursAt); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..bcca0e9803 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateTransportRequest.cs index 44f3e1c9d1..06f4cf39e3 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateTransportRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateTransportRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateTransportRequest : IBackedModel, IParsable + public partial class AttributesInCreateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The durationInMinutes property public int? DurationInMinutes { @@ -32,20 +28,12 @@ public int? Type set { BackingStore?.Set("type", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateTransportRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateTransportRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, { "type", n => { Type = n.GetIntValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteIntValue("durationInMinutes", DurationInMinutes); writer.WriteIntValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateVacationRequest.cs index 0072b4179a..811ad4e362 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateVacationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateVacationRequest : IBackedModel, IParsable + public partial class AttributesInCreateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The endsAt property public DateTimeOffset? EndsAt { @@ -32,20 +28,12 @@ public DateTimeOffset? StartsAt set { BackingStore?.Set("startsAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateVacationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateVacationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, { "startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDateTimeOffsetValue("endsAt", EndsAt); writer.WriteDateTimeOffsetValue("startsAt", StartsAt); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInExcursionResponse.cs similarity index 67% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInExcursionResponse.cs index 94d2185643..7c831ef525 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInExcursionResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ExcursionAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInExcursionResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -32,32 +28,24 @@ public DateTimeOffset? OccursAt set { BackingStore?.Set("occursAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public ExcursionAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteDateTimeOffsetValue("occursAt", OccursAt); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..cb3437aec3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInTransportResponse.cs similarity index 67% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInTransportResponse.cs index c47c0aad27..ae69b72286 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInTransportResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TransportAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInTransportResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The durationInMinutes property public int? DurationInMinutes { @@ -32,32 +28,24 @@ public int? Type set { BackingStore?.Set("type", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public TransportAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, { "type", n => { Type = n.GetIntValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteIntValue("durationInMinutes", DurationInMinutes); writer.WriteIntValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateAccommodationRequest.cs index d05e229030..a407e9978b 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateAccommodationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateAccommodationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateAccommodationRequest : IBackedModel, IParsable + public partial class AttributesInUpdateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The address property @@ -22,23 +21,12 @@ public string? Address set { BackingStore?.Set("address", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateAccommodationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest(); @@ -48,9 +36,9 @@ public AttributesInUpdateAccommodationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "address", n => { Address = n.GetStringValue(); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("address", Address); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateExcursionRequest.cs index 7b7cbd2b49..f69cac01a9 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateExcursionRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateExcursionRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateExcursionRequest : IBackedModel, IParsable + public partial class AttributesInUpdateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The description property public string? Description { @@ -32,20 +28,12 @@ public DateTimeOffset? OccursAt set { BackingStore?.Set("occursAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateExcursionRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateExcursionRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "description", n => { Description = n.GetStringValue(); } }, { "occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("description", Description); writer.WriteDateTimeOffsetValue("occursAt", OccursAt); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..5deb0f1a93 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateTransportRequest.cs index 0dcfcc5d85..3450183500 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateTransportRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateTransportRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateTransportRequest : IBackedModel, IParsable + public partial class AttributesInUpdateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The durationInMinutes property public int? DurationInMinutes { @@ -32,20 +28,12 @@ public int? Type set { BackingStore?.Set("type", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateTransportRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateTransportRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, { "type", n => { Type = n.GetIntValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteIntValue("durationInMinutes", DurationInMinutes); writer.WriteIntValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateVacationRequest.cs index 139a6de8ff..4826779630 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateVacationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateVacationRequest : IBackedModel, IParsable + public partial class AttributesInUpdateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The endsAt property public DateTimeOffset? EndsAt { @@ -32,20 +28,12 @@ public DateTimeOffset? StartsAt set { BackingStore?.Set("startsAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateVacationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateVacationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, { "startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDateTimeOffsetValue("endsAt", EndsAt); writer.WriteDateTimeOffsetValue("startsAt", StartsAt); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInVacationResponse.cs similarity index 67% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInVacationResponse.cs index 23f40cc8b9..2f19135f5b 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInVacationResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class VacationAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInVacationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The endsAt property public DateTimeOffset? EndsAt { @@ -32,32 +28,24 @@ public DateTimeOffset? StartsAt set { BackingStore?.Set("startsAt", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public VacationAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, { "startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDateTimeOffsetValue("endsAt", EndsAt); writer.WriteDateTimeOffsetValue("startsAt", StartsAt); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInAccommodationResponse.cs similarity index 84% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInAccommodationResponse.cs index 0cca012a02..0897645649 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInAccommodationResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AccommodationDataInResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInAccommodationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -38,12 +38,12 @@ public string? Id /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse(); } /// @@ -54,7 +54,7 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, }; @@ -68,7 +68,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs index 7d52350df0..c15b5b21e8 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateAccommodationRequest : IBackedModel, IParsable + public partial class DataInCreateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,37 +21,12 @@ public partial class DataInCreateAccommodationRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateAccommodationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest(); @@ -62,13 +36,11 @@ public DataInCreateAccommodationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 cd11e30f6c..e0601a86b7 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateExcursionRequest : IBackedModel, IParsable + public partial class DataInCreateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,37 +21,12 @@ public partial class DataInCreateExcursionRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateExcursionRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest(); @@ -62,13 +36,11 @@ public DataInCreateExcursionRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 5748b0304e..7fe0892ac9 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateTransportRequest : IBackedModel, IParsable + public partial class DataInCreateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,37 +21,12 @@ public partial class DataInCreateTransportRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateTransportRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest(); @@ -62,13 +36,11 @@ public DataInCreateTransportRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 6582324af2..c17c50264f 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateVacationRequest : IBackedModel, IParsable + public partial class DataInCreateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,16 +21,6 @@ public partial class DataInCreateVacationRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest? Relationships { @@ -39,27 +28,12 @@ public partial class DataInCreateVacationRequest : IBackedModel, IParsable set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateVacationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest(); @@ -69,14 +43,12 @@ public DataInCreateVacationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/TransportDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInExcursionResponse.cs similarity index 84% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInExcursionResponse.cs index 851ff25b0e..c18d507d5c 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInExcursionResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TransportDataInResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInExcursionResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -38,12 +38,12 @@ public string? Id /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse(); } /// @@ -54,7 +54,7 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, }; @@ -68,7 +68,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInTransportResponse.cs similarity index 84% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInTransportResponse.cs index 37666622e9..4c0d872b89 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInTransportResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ExcursionDataInResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInTransportResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -38,12 +38,12 @@ public string? Id /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse(); } /// @@ -54,7 +54,7 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, }; @@ -68,7 +68,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs index cc57e1b353..16d4fd8a2c 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateAccommodationRequest : IBackedModel, IParsable + public partial class DataInUpdateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateAccommodationRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateAccommodationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest(); @@ -69,14 +43,12 @@ public DataInUpdateAccommodationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 6c40321f78..e25c8fbfab 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateExcursionRequest : IBackedModel, IParsable + public partial class DataInUpdateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateExcursionRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateExcursionRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest(); @@ -69,14 +43,12 @@ public DataInUpdateExcursionRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 ce4098d791..797d61a73d 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateTransportRequest : IBackedModel, IParsable + public partial class DataInUpdateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateTransportRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,34 +28,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateTransportRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest(); @@ -69,14 +43,12 @@ public DataInUpdateTransportRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 d891125441..a53cee4371 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateVacationRequest : IBackedModel, IParsable + public partial class DataInUpdateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateVacationRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,13 +28,6 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest? Relationships { @@ -46,27 +35,12 @@ public string? Id set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateVacationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest(); @@ -76,15 +50,13 @@ public DataInUpdateVacationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/VacationDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInVacationResponse.cs similarity index 81% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInVacationResponse.cs index c7efe46a01..1cad15d111 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInVacationResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class VacationDataInResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInVacationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs index 87389bd7b8..bde5dd575c 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class ExcursionCollectionResponseDocument : IBackedModel, IParsab public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); 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 a750573a83..5ff36171cf 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ExcursionIdentifierInRequest : IBackedModel, IParsable + public partial class ExcursionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -25,34 +21,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public ExcursionIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest(); @@ -62,13 +36,11 @@ public ExcursionIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetStringValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..2909b955ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableSecondaryTransportResponseDocument.cs similarity index 79% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableSecondaryTransportResponseDocument.cs index ee42b53d7d..2956c71ea8 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableSecondaryTransportResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NullableTransportSecondaryResponseDocument : IBackedModel, IParsable + public partial class NullableSecondaryTransportResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class NullableTransportSecondaryResponseDocument : IBackedModel, } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public NullableTransportSecondaryResponseDocument() + public NullableSecondaryTransportResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public NullableTransportSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableTransportSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableSecondaryTransportResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableTransportSecondaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableSecondaryTransportResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryAccommodationResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryAccommodationResponseDocument.cs index 242141f743..c06dd1abeb 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryAccommodationResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AccommodationPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryAccommodationResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class AccommodationPrimaryResponseDocument : IBackedModel, IParsa } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public AccommodationPrimaryResponseDocument() + public PrimaryAccommodationResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public AccommodationPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryExcursionResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryExcursionResponseDocument.cs index ab765fe00e..8b690688d4 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryExcursionResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ExcursionPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryExcursionResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class ExcursionPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public ExcursionPrimaryResponseDocument() + public PrimaryExcursionResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public ExcursionPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryTransportResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryTransportResponseDocument.cs index 7199cfb099..09bb6d5cb5 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryTransportResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TransportPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryTransportResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class TransportPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public TransportPrimaryResponseDocument() + public PrimaryTransportResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public TransportPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryVacationResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryVacationResponseDocument.cs index d1d9ecc2e4..aa4f702d38 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryVacationResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class VacationPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryVacationResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class VacationPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public VacationPrimaryResponseDocument() + public PrimaryVacationResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public VacationPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..59563b8f0b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateVacationRequest.cs index e5ed6e2ea6..c4e7a6032b 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateVacationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateVacationRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { /// The accommodation property @@ -22,9 +21,6 @@ public partial class RelationshipsInCreateVacationRequest : IBackedModel, IParsa set { BackingStore?.Set("accommodation", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The excursions property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest? Excursions { @@ -39,20 +35,12 @@ public partial class RelationshipsInCreateVacationRequest : IBackedModel, IParsa set { BackingStore?.Set("transport", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateVacationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest(); @@ -62,9 +50,9 @@ public RelationshipsInCreateVacationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "accommodation", n => { Accommodation = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest.CreateFromDiscriminatorValue); } }, { "excursions", n => { Excursions = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("accommodation", Accommodation); writer.WriteObjectValue("excursions", Excursions); writer.WriteObjectValue("transport", Transport); diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..aff2fbf974 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..c0d40587cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateVacationRequest.cs index b08f577e8d..8579e6ef66 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateVacationRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateVacationRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The accommodation property @@ -22,9 +21,6 @@ public partial class RelationshipsInUpdateVacationRequest : IBackedModel, IParsa set { BackingStore?.Set("accommodation", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The excursions property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest? Excursions { @@ -39,20 +35,12 @@ public partial class RelationshipsInUpdateVacationRequest : IBackedModel, IParsa set { BackingStore?.Set("transport", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateVacationRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest(); @@ -62,9 +50,9 @@ public RelationshipsInUpdateVacationRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "accommodation", n => { Accommodation = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest.CreateFromDiscriminatorValue); } }, { "excursions", n => { Excursions = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("accommodation", Accommodation); writer.WriteObjectValue("excursions", Excursions); writer.WriteObjectValue("transport", Transport); diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInVacationResponse.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInVacationResponse.cs index 2d5bb1f367..180d1aab6c 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInVacationResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class VacationRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInVacationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { /// The accommodation property @@ -22,9 +21,6 @@ public partial class VacationRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("accommodation", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The excursions property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInResponse? Excursions { @@ -39,32 +35,24 @@ public partial class VacationRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("transport", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public VacationRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "accommodation", n => { Accommodation = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInResponse.CreateFromDiscriminatorValue); } }, { "excursions", n => { Excursions = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInResponse.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("accommodation", Accommodation); writer.WriteObjectValue("excursions", Excursions); writer.WriteObjectValue("transport", Transport); diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..006c636142 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInResponse.cs similarity index 85% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInResponse.cs index 8a5e812710..ef0edc7b11 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInResponse.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class ResourceInResponse : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public ResourceInResponse() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,19 +43,19 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse(), - "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionDataInResponse(), - "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse(), - "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationDataInResponse(), - _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse(), + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse(), }; } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..d216bc05c3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/SecondaryAccommodationResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/SecondaryAccommodationResponseDocument.cs index 604fd7fb46..7275a54806 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/SecondaryAccommodationResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AccommodationSecondaryResponseDocument : IBackedModel, IParsable + public partial class SecondaryAccommodationResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class AccommodationSecondaryResponseDocument : IBackedModel, IPar } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public AccommodationSecondaryResponseDocument() + public SecondaryAccommodationResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public AccommodationSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.SecondaryAccommodationResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationSecondaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.SecondaryAccommodationResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs index 8c973c2fe5..7110d5b545 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class TransportCollectionResponseDocument : IBackedModel, IParsab public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); 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 d66a450e96..7f03dfd042 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class TransportIdentifierInRequest : IBackedModel, IParsable + public partial class TransportIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -25,34 +21,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public TransportIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest(); @@ -62,13 +36,11 @@ public TransportIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetStringValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs index 011f6689de..60112bb059 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class VacationCollectionResponseDocument : IBackedModel, IParsabl public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs index da28a00bde..0929e31a11 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs @@ -56,12 +56,12 @@ public async Task DeleteAsync(Action /// Retrieves an individual transport by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -69,7 +69,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -86,7 +86,7 @@ public async Task HeadAsync(Action /// Updates an existing transport. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -94,7 +94,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateTransportRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateTransportRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -105,7 +105,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -117,7 +117,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Creates a new transport. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateTransportRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateTransportRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related accommodation of an individual vacation's accommodation relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public AccommodationRequestBuilder(string rawUrl, IRequestAdapter requestAdapter { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.SecondaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related transport of an individual vacation's transport relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public TransportRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableTransportSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableSecondaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual vacation by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -97,7 +97,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -114,7 +114,7 @@ public async Task HeadAsync(Action /// Updates an existing vacation. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -122,7 +122,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateVacationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateVacationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -133,7 +133,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -145,7 +145,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Creates a new vacation. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateVacationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateVacationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs index 9ce0611f48..1180b1d39a 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using Microsoft.Kiota.Abstractions; using System.Collections.Generic; using System.IO; @@ -13,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateSocialMediaAccountRequest : IBackedModel, IParsable + public partial class AttributesInCreateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { /// The age property @@ -37,9 +36,6 @@ public string? BackgroundPicture set { BackingStore?.Set("backgroundPicture", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The countryCode property public string? CountryCode { @@ -145,20 +141,12 @@ public Time? ValidatedAtTime set { BackingStore?.Set("validatedAtTime", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateSocialMediaAccountRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest(); @@ -168,9 +156,9 @@ public AttributesInCreateSocialMediaAccountRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "age", n => { Age = n.GetDoubleValue(); } }, { "alternativeId", n => { AlternativeId = n.GetGuidValue(); } }, @@ -197,9 +185,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDoubleValue("age", Age); writer.WriteGuidValue("alternativeId", AlternativeId); writer.WriteStringValue("backgroundPicture", BackgroundPicture); diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..40ca9d3903 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInSocialMediaAccountResponse.cs similarity index 87% rename from test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInSocialMediaAccountResponse.cs index 230684eee2..68dee62e83 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInSocialMediaAccountResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using Microsoft.Kiota.Abstractions; using System.Collections.Generic; using System.IO; @@ -13,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class SocialMediaAccountAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInSocialMediaAccountResponse : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { /// The age property @@ -37,9 +36,6 @@ public string? BackgroundPicture set { BackingStore?.Set("backgroundPicture", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The countryCode property public string? CountryCode { @@ -145,32 +141,24 @@ public Time? ValidatedAtTime set { BackingStore?.Set("validatedAtTime", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public SocialMediaAccountAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "age", n => { Age = n.GetDoubleValue(); } }, { "alternativeId", n => { AlternativeId = n.GetGuidValue(); } }, @@ -197,9 +185,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDoubleValue("age", Age); writer.WriteGuidValue("alternativeId", AlternativeId); writer.WriteStringValue("backgroundPicture", BackgroundPicture); diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..1458bf604b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs index 76bd2d8888..76e7aead9a 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using Microsoft.Kiota.Abstractions; using System.Collections.Generic; using System.IO; @@ -13,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateSocialMediaAccountRequest : IBackedModel, IParsable + public partial class AttributesInUpdateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The age property @@ -37,9 +36,6 @@ public string? BackgroundPicture set { BackingStore?.Set("backgroundPicture", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The countryCode property public string? CountryCode { @@ -145,20 +141,12 @@ public Time? ValidatedAtTime set { BackingStore?.Set("validatedAtTime", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateSocialMediaAccountRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest(); @@ -168,9 +156,9 @@ public AttributesInUpdateSocialMediaAccountRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "age", n => { Age = n.GetDoubleValue(); } }, { "alternativeId", n => { AlternativeId = n.GetGuidValue(); } }, @@ -197,9 +185,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteDoubleValue("age", Age); writer.WriteGuidValue("alternativeId", AlternativeId); writer.WriteStringValue("backgroundPicture", BackgroundPicture); diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs index c2bf711aca..b2a9fe8fc4 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateSocialMediaAccountRequest : IBackedModel, IParsable + public partial class DataInCreateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,37 +21,12 @@ public partial class DataInCreateSocialMediaAccountRequest : IBackedModel, IPars set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateSocialMediaAccountRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest(); @@ -62,13 +36,11 @@ public DataInCreateSocialMediaAccountRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInSocialMediaAccountResponse.cs similarity index 83% rename from test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInSocialMediaAccountResponse.cs index 75052a128a..5d4e2e2249 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInSocialMediaAccountResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class SocialMediaAccountDataInResponse : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInSocialMediaAccountResponse : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -38,12 +38,12 @@ public Guid? Id /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse(); } /// @@ -54,7 +54,7 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, }; @@ -68,7 +68,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs index 62cefddf43..a42f2f8330 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateSocialMediaAccountRequest : IBackedModel, IParsable + public partial class DataInUpdateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateSocialMediaAccountRequest : IBackedModel, IPars set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public Guid? Id { @@ -32,34 +28,12 @@ public Guid? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateSocialMediaAccountRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest(); @@ -69,14 +43,12 @@ public DataInUpdateSocialMediaAccountRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/SocialMediaAccountPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/PrimarySocialMediaAccountResponseDocument.cs similarity index 77% rename from test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/PrimarySocialMediaAccountResponseDocument.cs index 90c8b4fe04..0013b483f6 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/PrimarySocialMediaAccountResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class SocialMediaAccountPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimarySocialMediaAccountResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class SocialMediaAccountPrimaryResponseDocument : IBackedModel, I } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public SocialMediaAccountPrimaryResponseDocument() + public PrimarySocialMediaAccountResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public SocialMediaAccountPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..442849bb0e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInResponse.cs similarity index 87% rename from test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInResponse.cs index 4473199e16..5984a83a76 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInResponse.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class ResourceInResponse : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public ResourceInResponse() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,16 +43,16 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountDataInResponse(), - _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInResponse(), + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse(), }; } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..5ee530f218 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/Item/SocialMediaAccountsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/Item/SocialMediaAccountsItemRequestBuilder.cs index f7eb31e093..ae98f228ee 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/Item/SocialMediaAccountsItemRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/Item/SocialMediaAccountsItemRequestBuilder.cs @@ -40,7 +40,7 @@ public SocialMediaAccountsItemRequestBuilder(string rawUrl, IRequestAdapter requ /// /// Updates an existing socialMediaAccount. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -48,7 +48,7 @@ public SocialMediaAccountsItemRequestBuilder(string rawUrl, IRequestAdapter requ /// When receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.UpdateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.UpdateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -59,7 +59,7 @@ public SocialMediaAccountsItemRequestBuilder(string rawUrl, IRequestAdapter requ { "409", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "422", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -73,8 +73,8 @@ public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEnd _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); return requestInfo; } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/SocialMediaAccountsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/SocialMediaAccountsRequestBuilder.cs index a274dfcdb0..0a35a41272 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/SocialMediaAccountsRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/SocialMediaAccountsRequestBuilder.cs @@ -54,7 +54,7 @@ public SocialMediaAccountsRequestBuilder(string rawUrl, IRequestAdapter requestA /// /// Creates a new socialMediaAccount. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -63,7 +63,7 @@ public SocialMediaAccountsRequestBuilder(string rawUrl, IRequestAdapter requestA /// When receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.CreateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.CreateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -75,7 +75,7 @@ public SocialMediaAccountsRequestBuilder(string rawUrl, IRequestAdapter requestA { "409", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "422", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -89,8 +89,8 @@ public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndT _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); return requestInfo; } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs index a409f8ecbe..5a6022df63 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs @@ -1,5 +1,4 @@ using FluentAssertions; -using JsonApiDotNetCore.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Kiota.Http.HttpClientLibrary; using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode; @@ -9,6 +8,7 @@ using TestBuildingBlocks; using Xunit; using Xunit.Abstractions; +using IJsonApiOptions = JsonApiDotNetCore.Configuration.IJsonApiOptions; namespace OpenApiKiotaEndToEndTests.ModelStateValidation; @@ -46,7 +46,7 @@ public async Task Cannot_exceed_length_constraint(string firstName) { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { FirstName = firstName, @@ -84,7 +84,7 @@ public async Task Cannot_exceed_string_length_constraint(string userName) { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -120,7 +120,7 @@ public async Task Cannot_violate_regular_expression_constraint() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -156,7 +156,7 @@ public async Task Cannot_use_invalid_credit_card_number() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -192,7 +192,7 @@ public async Task Cannot_use_invalid_email_address() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -228,7 +228,7 @@ public async Task Cannot_exceed_min_length_constraint() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -267,7 +267,7 @@ public async Task Cannot_exceed_max_length_constraint() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -309,7 +309,7 @@ public async Task Cannot_use_double_outside_of_valid_range(double age) { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -345,7 +345,7 @@ public async Task Cannot_use_relative_url() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -383,7 +383,7 @@ public async Task Cannot_exceed_collection_length_constraint(int length) { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -419,7 +419,7 @@ public async Task Cannot_use_non_allowed_value() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -455,7 +455,7 @@ public async Task Cannot_use_denied_value() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -491,7 +491,7 @@ public async Task Cannot_use_TimeSpan_outside_of_valid_range() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { LastName = newAccount.LastName, @@ -527,7 +527,7 @@ public async Task Can_create_resource_with_valid_properties() { Data = new DataInCreateSocialMediaAccountRequest { - Type = SocialMediaAccountResourceType.SocialMediaAccounts, + Type = ResourceType.SocialMediaAccounts, Attributes = new AttributesInCreateSocialMediaAccountRequest { AlternativeId = newAccount.AlternativeId, diff --git a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj index 700a151623..ca0db62217 100644 --- a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj +++ b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj @@ -65,6 +65,38 @@ ./%(Name)/GeneratedCode $(JsonApiExtraArguments) + + ResourceInheritance + NoOperations + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ResourceInheritance + OnlyRelationships + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ResourceInheritance + SubsetOfOperations + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ResourceInheritance + SubsetOfVarious + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + RestrictedControllers $(MSBuildProjectName).%(Name).GeneratedCode diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNameValuePairRequest.cs index af1c2696e6..83e852a185 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNameValuePairRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateNameValuePairRequest : IBackedModel, IParsable + public partial class AttributesInCreateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -32,20 +28,12 @@ public string? Value set { BackingStore?.Set("value", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateNameValuePairRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateNameValuePairRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, { "value", n => { Value = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); writer.WriteStringValue("value", Value); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNodeRequest.cs index 5c2fd24879..429463d2a5 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNodeRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateNodeRequest : IBackedModel, IParsable + public partial class AttributesInCreateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The comment property public string? Comment { @@ -32,20 +28,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateNodeRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest(); @@ -55,9 +43,9 @@ public AttributesInCreateNodeRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "comment", n => { Comment = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("comment", Comment); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..31ce729c77 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNameValuePairResponse.cs similarity index 65% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNameValuePairResponse.cs index e0fc2de901..5e691ca747 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNameValuePairResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NameValuePairAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInNameValuePairResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -32,32 +28,24 @@ public string? Value set { BackingStore?.Set("value", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public NameValuePairAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, { "value", n => { Value = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); writer.WriteStringValue("value", Value); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNodeResponse.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNodeResponse.cs index 9dddc26072..cff20802c5 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNodeResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NodeAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInNodeResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The comment property public string? Comment { @@ -32,32 +28,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public NodeAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "comment", n => { Comment = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("comment", Comment); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..a74152cdd6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNameValuePairRequest.cs index ca2a41016e..3979d32d08 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNameValuePairRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateNameValuePairRequest : IBackedModel, IParsable + public partial class AttributesInUpdateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The name property public string? Name { @@ -32,20 +28,12 @@ public string? Value set { BackingStore?.Set("value", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateNameValuePairRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateNameValuePairRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "name", n => { Name = n.GetStringValue(); } }, { "value", n => { Value = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("name", Name); writer.WriteStringValue("value", Value); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNodeRequest.cs index 089ffe9fe6..2dcd9bd224 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNodeRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateNodeRequest : IBackedModel, IParsable + public partial class AttributesInUpdateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The comment property public string? Comment { @@ -32,20 +28,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateNodeRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest(); @@ -55,9 +43,9 @@ public AttributesInUpdateNodeRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "comment", n => { Comment = n.GetStringValue(); } }, { "name", n => { Name = n.GetStringValue(); } }, @@ -68,9 +56,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("comment", Comment); writer.WriteStringValue("name", Name); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..41597dd5fb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs index 080913035f..6214682931 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateNameValuePairRequest : IBackedModel, IParsable + public partial class DataInCreateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,16 +21,6 @@ public partial class DataInCreateNameValuePairRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest? Relationships { @@ -39,27 +28,12 @@ public partial class DataInCreateNameValuePairRequest : IBackedModel, IParsable set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateNameValuePairRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest(); @@ -69,14 +43,12 @@ public DataInCreateNameValuePairRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 0623dd8a1e..48e6bfc6b6 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateNodeRequest : IBackedModel, IParsable + public partial class DataInCreateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,16 +21,6 @@ public partial class DataInCreateNodeRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest? Relationships { @@ -39,27 +28,12 @@ public partial class DataInCreateNodeRequest : IBackedModel, IParsable set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateNodeRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest(); @@ -69,14 +43,12 @@ public DataInCreateNodeRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/NameValuePairDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNameValuePairResponse.cs similarity index 75% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNameValuePairResponse.cs index 89c2edb32c..4d1dd05d94 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNameValuePairResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NameValuePairDataInResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInNameValuePairResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNodeResponse.cs similarity index 79% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNodeResponse.cs index 6350f7d453..297d9072eb 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNodeResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NodeDataInResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInNodeResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs index 0d3e9e626a..fb123dff1b 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateNameValuePairRequest : IBackedModel, IParsable + public partial class DataInUpdateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateNameValuePairRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,13 +28,6 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest? Relationships { @@ -46,27 +35,12 @@ public string? Id set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateNameValuePairRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest(); @@ -76,15 +50,13 @@ public DataInUpdateNameValuePairRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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 cb5fa0f934..b2856cc56c 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateNodeRequest : IBackedModel, IParsable + public partial class DataInUpdateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateNodeRequest : IBackedModel, IParsable set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,13 +28,6 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest? Relationships { @@ -46,27 +35,12 @@ public string? Id set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateNodeRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest(); @@ -76,15 +50,13 @@ public DataInUpdateNodeRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..40554d6177 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs index 144694d9c1..8f0ed84c22 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class NameValuePairCollectionResponseDocument : IBackedModel, IPa public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs index 3f1d4f8d52..f26a216168 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NameValuePairIdentifierInRequest : IBackedModel, IParsable + public partial class NameValuePairIdentifierInRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -25,34 +21,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public NameValuePairIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest(); @@ -62,13 +36,11 @@ public NameValuePairIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetStringValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs index 6c533053dc..ed17d2fb0a 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class NodeCollectionResponseDocument : IBackedModel, IParsable public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs index d7fb8e1ede..bf3423dfc8 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NodeIdentifierInRequest : IBackedModel, IParsable + public partial class NodeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -25,34 +21,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public NodeIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest(); @@ -62,13 +36,11 @@ public NodeIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetStringValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableSecondaryNodeResponseDocument.cs similarity index 79% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeSecondaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableSecondaryNodeResponseDocument.cs index a8700b27e4..d29a252b19 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableSecondaryNodeResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NullableNodeSecondaryResponseDocument : IBackedModel, IParsable + public partial class NullableSecondaryNodeResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class NullableNodeSecondaryResponseDocument : IBackedModel, IPars } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public NullableNodeSecondaryResponseDocument() + public NullableSecondaryNodeResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public NullableNodeSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableNodeSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableSecondaryNodeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableNodeSecondaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableSecondaryNodeResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNameValuePairResponseDocument.cs similarity index 79% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNameValuePairResponseDocument.cs index 1f5ec46202..e2e0a23b1c 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNameValuePairResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NameValuePairPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryNameValuePairResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class NameValuePairPrimaryResponseDocument : IBackedModel, IParsa } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public NameValuePairPrimaryResponseDocument() + public PrimaryNameValuePairResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public NameValuePairPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodePrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNodeResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodePrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNodeResponseDocument.cs index 540f868eae..2bcbbde79d 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodePrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNodeResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NodePrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryNodeResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class NodePrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public NodePrimaryResponseDocument() + public PrimaryNodeResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public NodePrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodePrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodePrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNameValuePairRequest.cs index 7955c5a110..e2fca0c85a 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNameValuePairRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateNameValuePairRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The owner property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest? Owner { @@ -25,20 +21,12 @@ public partial class RelationshipsInCreateNameValuePairRequest : IBackedModel, I set { BackingStore?.Set("owner", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateNameValuePairRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest(); @@ -48,9 +36,9 @@ public RelationshipsInCreateNameValuePairRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("owner", Owner); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNodeRequest.cs index 9a44bfd097..440c5a1a67 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNodeRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateNodeRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The children property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest? Children { @@ -39,20 +35,12 @@ public partial class RelationshipsInCreateNodeRequest : IBackedModel, IParsable set { BackingStore?.Set("values", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateNodeRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest(); @@ -62,9 +50,9 @@ public RelationshipsInCreateNodeRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "children", n => { Children = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest.CreateFromDiscriminatorValue); } }, { "parent", n => { Parent = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("children", Children); writer.WriteObjectValue("parent", Parent); writer.WriteObjectValue("values", Values); diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..9abf8566da --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNameValuePairResponse.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNameValuePairResponse.cs index c8d10d8783..fc77dd9aa1 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNameValuePairResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NameValuePairRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInNameValuePairResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The owner property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInResponse? Owner { @@ -25,32 +21,24 @@ public partial class NameValuePairRelationshipsInResponse : IBackedModel, IParsa set { BackingStore?.Set("owner", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public NameValuePairRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInResponse.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("owner", Owner); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNodeResponse.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNodeResponse.cs index 4a0de914ce..685406b888 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNodeResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NodeRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInNodeResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The children property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInResponse? Children { @@ -39,32 +35,24 @@ public partial class NodeRelationshipsInResponse : IBackedModel, IParsable set { BackingStore?.Set("values", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public NodeRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "children", n => { Children = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInResponse.CreateFromDiscriminatorValue); } }, { "parent", n => { Parent = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInResponse.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("children", Children); writer.WriteObjectValue("parent", Parent); writer.WriteObjectValue("values", Values); diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..65b7ac3e6a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNameValuePairRequest.cs index a9521dcb76..488ff75aee 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNameValuePairRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateNameValuePairRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The owner property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest? Owner { @@ -25,20 +21,12 @@ public partial class RelationshipsInUpdateNameValuePairRequest : IBackedModel, I set { BackingStore?.Set("owner", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateNameValuePairRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest(); @@ -48,9 +36,9 @@ public RelationshipsInUpdateNameValuePairRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest.CreateFromDiscriminatorValue); } }, }; @@ -60,9 +48,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("owner", Owner); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNodeRequest.cs index b90775b850..bc58cc23b7 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNodeRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateNodeRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The children property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest? Children { @@ -39,20 +35,12 @@ public partial class RelationshipsInUpdateNodeRequest : IBackedModel, IParsable set { BackingStore?.Set("values", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateNodeRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest(); @@ -62,9 +50,9 @@ public RelationshipsInUpdateNodeRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "children", n => { Children = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest.CreateFromDiscriminatorValue); } }, { "parent", n => { Parent = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("children", Children); writer.WriteObjectValue("parent", Parent); writer.WriteObjectValue("values", Values); diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..b3aafacc11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..6d451530ab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInResponse.cs similarity index 87% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInResponse.cs index 0aaa165139..ac2165ae82 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInResponse.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class ResourceInResponse : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public ResourceInResponse() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,17 +43,17 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairDataInResponse(), - "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse(), - _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse(), + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse(), }; } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..40a5b9dcc0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/SecondaryNodeResponseDocument.cs similarity index 80% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeSecondaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/SecondaryNodeResponseDocument.cs index e12969ce6b..684c5459c3 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/SecondaryNodeResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NodeSecondaryResponseDocument : IBackedModel, IParsable + public partial class SecondaryNodeResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class NodeSecondaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public NodeSecondaryResponseDocument() + public SecondaryNodeResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public NodeSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.SecondaryNodeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeSecondaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.SecondaryNodeResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/NameValuePairsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/NameValuePairsItemRequestBuilder.cs index 8e04b4fda8..01e6a4b666 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/NameValuePairsItemRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/NameValuePairsItemRequestBuilder.cs @@ -70,12 +70,12 @@ public async Task DeleteAsync(Action /// Retrieves an individual nameValuePair by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -83,7 +83,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -100,7 +100,7 @@ public async Task HeadAsync(Action /// Updates an existing nameValuePair. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -108,7 +108,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNameValuePairRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNameValuePairRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -119,7 +119,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -131,7 +131,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Retrieves the related node of an individual nameValuePair's owner relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public OwnerRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.SecondaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Creates a new nameValuePair. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNameValuePairRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNameValuePairRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual node by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -97,7 +97,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodePrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -114,7 +114,7 @@ public async Task HeadAsync(Action /// Updates an existing node. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -122,7 +122,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNodeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNodeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -133,7 +133,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodePrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -145,7 +145,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Retrieves the related node of an individual node's parent relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public ParentRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : bas { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableNodeSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableSecondaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Creates a new node. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -91,7 +91,7 @@ public async Task HeadAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNodeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNodeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -103,7 +103,7 @@ public async Task HeadAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodePrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public RequestInformation ToGetRequestInformation(Action response.Data.ElementAt(0).Id.Should().Be(node.StringId); response.Included.Should().HaveCount(2); - 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); + 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] @@ -84,7 +84,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - NodePrimaryResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); // Assert response.Should().NotBeNull(); @@ -92,9 +92,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Id.Should().Be(node.StringId); response.Included.Should().HaveCount(3); - 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); + 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] @@ -128,8 +128,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Should().HaveCount(2); response.Included.Should().HaveCount(2); - response.Included.OfType().Should().ContainSingle(include => include.Id == node.StringId); - response.Included.OfType().Should().ContainSingle(include => 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] @@ -156,7 +156,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - NullableNodeSecondaryResponseDocument? response = await apiClient.Nodes[node.StringId!].Parent.GetAsync(); + NullableSecondaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].Parent.GetAsync(); // Assert response.Should().NotBeNull(); @@ -165,10 +165,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.Should().HaveCount(1); - response.Included.OfType().Should().ContainSingle(nodeData => nodeData.Id == node.Parent.Parent.StringId).Subject.With(nodeData => + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.Parent.StringId).Subject.With(include => { - nodeData.Attributes.Should().NotBeNull(); - nodeData.Attributes.Name.Should().Be(node.Parent.Parent.Name); + include.Attributes.Should().NotBeNull(); + include.Attributes.Name.Should().Be(node.Parent.Parent.Name); }); } @@ -193,7 +193,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - NodePrimaryResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); // Assert response.Should().NotBeNull(); diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/SparseFieldSetTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/SparseFieldSetTests.cs index 4d2b0ac6d8..f2d76023f8 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/SparseFieldSetTests.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/SparseFieldSetTests.cs @@ -84,7 +84,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - NodePrimaryResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); // Assert response.Should().NotBeNull(); @@ -163,7 +163,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - NullableNodeSecondaryResponseDocument? response = await apiClient.Nodes[node.StringId!].Parent.GetAsync(); + NullableSecondaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].Parent.GetAsync(); // Assert response.Should().NotBeNull(); @@ -198,7 +198,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - NodePrimaryResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); // Assert response.Should().NotBeNull(); diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs new file mode 100644 index 0000000000..34608e41f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms +{ + /// + /// Builds and executes requests for operations under \bathrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.bathrooms.item collection + /// The identifier of the bathroom to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of bathrooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new bathroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of bathrooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of bathrooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new bathroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..7bad7a5678 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing bathroom by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual bathroom by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing bathroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing bathroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual bathroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual bathroom by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing bathroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..3b90f465c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..1a54eff2ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..33d9f5449c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual bathroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual bathroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual bathroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs new file mode 100644 index 0000000000..1840a6c635 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms +{ + /// + /// Builds and executes requests for operations under \bedrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.bedrooms.item collection + /// The identifier of the bedroom to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of bedrooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new bedroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of bedrooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of bedrooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new bedroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..57973ce98f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing bedroom by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual bedroom by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing bedroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing bedroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual bedroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual bedroom by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing bedroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..598e388d8a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..d29f2e5942 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..6135d54b25 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual bedroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual bedroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual bedroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..a7b82a36b4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings +{ + /// + /// Builds and executes requests for operations under \buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.buildings.item collection + /// The identifier of the building to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of buildings. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of buildings. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of buildings. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs new file mode 100644 index 0000000000..21def4f450 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item +{ + /// + /// Builds and executes requests for operations under \buildings\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing building by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual building by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing building by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual building by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual building by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs new file mode 100644 index 0000000000..33f67a3fc6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths +{ + /// + /// Builds and executes requests for operations under \cyclePaths + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.cyclePaths.item collection + /// The identifier of the cyclePath to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of cyclePaths. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new cyclePath. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of cyclePaths. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new cyclePath. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of cyclePaths. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new cyclePath. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs new file mode 100644 index 0000000000..04478d64d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item +{ + /// + /// Builds and executes requests for operations under \cyclePaths\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing cyclePath by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing cyclePath. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing cyclePath by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing cyclePath. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing cyclePath. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/DistrictsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/DistrictsRequestBuilder.cs new file mode 100644 index 0000000000..84fde078ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/DistrictsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts +{ + /// + /// Builds and executes requests for operations under \districts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.districts.item collection + /// The identifier of the district to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder this[Guid position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DistrictCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new district. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of districts. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new district. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..97697a878c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings +{ + /// + /// Builds and executes requests for operations under \districts\{id}\buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/buildings{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related buildings of an individual district's buildings relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related buildings of an individual district's buildings relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related buildings of an individual district's buildings relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs new file mode 100644 index 0000000000..a53f46f4cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs @@ -0,0 +1,230 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item +{ + /// + /// Builds and executes requests for operations under \districts\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilder : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing district by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual district by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing district. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing district by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual district by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual district by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing district. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..4748494921 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", rawUrl) + { + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..4d174d56d3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..99cbc09bde --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", rawUrl) + { + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..634873f4be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads +{ + /// + /// Builds and executes requests for operations under \districts\{id}\roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/roads{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related roads of an individual district's roads relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related roads of an individual district's roads relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related roads of an individual district's roads relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs new file mode 100644 index 0000000000..74cc7fcfec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes +{ + /// + /// Builds and executes requests for operations under \familyHomes + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.familyHomes.item collection + /// The identifier of the familyHome to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of familyHomes. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new familyHome. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of familyHomes. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of familyHomes. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new familyHome. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs new file mode 100644 index 0000000000..5cd86b9293 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing familyHome by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual familyHome by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing familyHome. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing familyHome by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual familyHome by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual familyHome by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing familyHome. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..07f1485722 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..ec7dc70718 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..1bff7a15bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related rooms of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related rooms of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related rooms of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs new file mode 100644 index 0000000000..c333387544 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item +{ + /// + /// Builds and executes requests for operations under \kitchens\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing kitchen by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual kitchen by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing kitchen. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing kitchen by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual kitchen by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual kitchen by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing kitchen. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..c4e1dd41e5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..518743a34d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..3aeba693c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual kitchen's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual kitchen's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual kitchen's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/KitchensRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/KitchensRequestBuilder.cs new file mode 100644 index 0000000000..9550379dbc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/KitchensRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens +{ + /// + /// Builds and executes requests for operations under \kitchens + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.kitchens.item collection + /// The identifier of the kitchen to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of kitchens. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new kitchen. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of kitchens. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of kitchens. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new kitchen. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..707839f5b5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing livingRoom by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual livingRoom by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing livingRoom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing livingRoom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual livingRoom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual livingRoom by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing livingRoom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..f94fee1287 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..04baa480d3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..94c62f4484 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual livingRoom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual livingRoom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual livingRoom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs new file mode 100644 index 0000000000..fd88e306a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms +{ + /// + /// Builds and executes requests for operations under \livingRooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.livingRooms.item collection + /// The identifier of the livingRoom to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of livingRooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new livingRoom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of livingRooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of livingRooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new livingRoom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs new file mode 100644 index 0000000000..9f2408c428 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs @@ -0,0 +1,230 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item +{ + /// + /// Builds and executes requests for operations under \mansions\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder Staff + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing mansion by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual mansion by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing mansion. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing mansion by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual mansion by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual mansion by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing mansion. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..0a490103df --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder Staff + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..096d7a183e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs new file mode 100644 index 0000000000..219198b689 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\staff + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", rawUrl) + { + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..e14200cf8e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related rooms of an individual mansion's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related rooms of an individual mansion's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related rooms of an individual mansion's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Staff/StaffRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Staff/StaffRequestBuilder.cs new file mode 100644 index 0000000000..6215a14033 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Staff/StaffRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\staff + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/staff{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/staff{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related staffMembers of an individual mansion's staff relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related staffMembers of an individual mansion's staff relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related staffMembers of an individual mansion's staff relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/MansionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/MansionsRequestBuilder.cs new file mode 100644 index 0000000000..1230c0f5ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/MansionsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions +{ + /// + /// Builds and executes requests for operations under \mansions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.mansions.item collection + /// The identifier of the mansion to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of mansions. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new mansion. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of mansions. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of mansions. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new mansion. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..6a330e8052 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..72c6061598 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs new file mode 100644 index 0000000000..f475aa09f9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs new file mode 100644 index 0000000000..52408928f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs new file mode 100644 index 0000000000..0d95aa7196 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs new file mode 100644 index 0000000000..301d794d42 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs new file mode 100644 index 0000000000..8d75a4efec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs new file mode 100644 index 0000000000..cc34a8ab0a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateCyclePathRequest.cs new file mode 100644 index 0000000000..a94f35bd20 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateCyclePathRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateDistrictRequest.cs new file mode 100644 index 0000000000..8eef5f29d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateDistrictRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..097c47099b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs new file mode 100644 index 0000000000..60f83f5faa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..99d12264dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs new file mode 100644 index 0000000000..fda98370a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..250635de7e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs new file mode 100644 index 0000000000..4978f20cd8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoadRequest.cs new file mode 100644 index 0000000000..151bb6cf5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoadRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs new file mode 100644 index 0000000000..3d0a9e66af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateStaffMemberRequest.cs new file mode 100644 index 0000000000..c931b12b05 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateStaffMemberRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs new file mode 100644 index 0000000000..ce7a9e34f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCyclePathResponse.cs new file mode 100644 index 0000000000..dd71a1b1db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCyclePathResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInDistrictResponse.cs new file mode 100644 index 0000000000..edcee26109 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInDistrictResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs new file mode 100644 index 0000000000..47c1fb3b50 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs new file mode 100644 index 0000000000..4dcf0cc6a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs new file mode 100644 index 0000000000..da11af8e85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInMansionResponse.cs new file mode 100644 index 0000000000..a7f35ef114 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs new file mode 100644 index 0000000000..071cb0e9ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..5ac3043709 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoadResponse.cs new file mode 100644 index 0000000000..353d2b3cac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoadResponse.cs @@ -0,0 +1,64 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoomResponse.cs new file mode 100644 index 0000000000..29a8fe49b7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInStaffMemberResponse.cs new file mode 100644 index 0000000000..3fe18d992a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInStaffMemberResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInToiletResponse.cs new file mode 100644 index 0000000000..c754bda18d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInToiletResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBathroomRequest.cs new file mode 100644 index 0000000000..4d46869958 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBathroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBedroomRequest.cs new file mode 100644 index 0000000000..c8534337f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBedroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..cbb1f2ce16 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateCyclePathRequest.cs new file mode 100644 index 0000000000..b12f5019e9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateCyclePathRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateDistrictRequest.cs new file mode 100644 index 0000000000..46b958d283 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateDistrictRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..afb9ac9543 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateKitchenRequest.cs new file mode 100644 index 0000000000..0420a8da2e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateKitchenRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateLivingRoomRequest.cs new file mode 100644 index 0000000000..39140a4f6e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateLivingRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs new file mode 100644 index 0000000000..50c0ba0f0b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..15c7d4374e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..273f263669 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoadRequest.cs new file mode 100644 index 0000000000..a936222f15 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoadRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoomRequest.cs new file mode 100644 index 0000000000..3f22f9b402 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateStaffMemberRequest.cs new file mode 100644 index 0000000000..d378d79f6c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateStaffMemberRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateToiletRequest.cs new file mode 100644 index 0000000000..97e23c3a87 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateToiletRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomCollectionResponseDocument.cs new file mode 100644 index 0000000000..22ac6bbbb0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BathroomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..aeeb9c4ec9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..b05115519b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomCollectionResponseDocument.cs new file mode 100644 index 0000000000..a1b8258f5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BedroomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..26d6bdc060 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..e6084ade45 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingCollectionResponseDocument.cs new file mode 100644 index 0000000000..de70d18e6c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..94835279fc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs new file mode 100644 index 0000000000..4fd807029f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..9f6d930774 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..96359f1803 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBathroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBathroomRequestDocument.cs new file mode 100644 index 0000000000..8cce0e4061 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBathroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBathroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBathroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBedroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBedroomRequestDocument.cs new file mode 100644 index 0000000000..f413f2ce22 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBedroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBedroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBedroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBuildingRequestDocument.cs new file mode 100644 index 0000000000..7976336947 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateCyclePathRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateCyclePathRequestDocument.cs new file mode 100644 index 0000000000..efca2efb7f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateCyclePathRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateCyclePathRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateCyclePathRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateDistrictRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateDistrictRequestDocument.cs new file mode 100644 index 0000000000..d14a96477d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateDistrictRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateDistrictRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateDistrictRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateFamilyHomeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateFamilyHomeRequestDocument.cs new file mode 100644 index 0000000000..d1856d8858 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateFamilyHomeRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateFamilyHomeRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateFamilyHomeRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateKitchenRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateKitchenRequestDocument.cs new file mode 100644 index 0000000000..cd810b9ba4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateKitchenRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateKitchenRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateKitchenRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateLivingRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateLivingRoomRequestDocument.cs new file mode 100644 index 0000000000..f2299f2581 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateLivingRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateLivingRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateLivingRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateMansionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateMansionRequestDocument.cs new file mode 100644 index 0000000000..bb29334949 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateMansionRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateMansionRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateMansionRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateResidenceRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateResidenceRequestDocument.cs new file mode 100644 index 0000000000..7c58e8cb68 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateResidenceRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateResidenceRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateResidenceRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoadRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoadRequestDocument.cs new file mode 100644 index 0000000000..5e63e19af7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoadRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateRoadRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateRoadRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoomRequestDocument.cs new file mode 100644 index 0000000000..865ecfe4e1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateStaffMemberRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateStaffMemberRequestDocument.cs new file mode 100644 index 0000000000..2c1cbf0b3e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateStaffMemberRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateStaffMemberRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateStaffMemberRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateToiletRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateToiletRequestDocument.cs new file mode 100644 index 0000000000..f8cf45bef2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateToiletRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateToiletRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateToiletRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathCollectionResponseDocument.cs new file mode 100644 index 0000000000..b0f928ca37 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CyclePathCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInRequest.cs new file mode 100644 index 0000000000..9bb5f6097b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInResponse.cs new file mode 100644 index 0000000000..eeec76d0cf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBathroomResponse.cs new file mode 100644 index 0000000000..3e623201a9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBedroomResponse.cs new file mode 100644 index 0000000000..d4fb16318a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBuildingResponse.cs new file mode 100644 index 0000000000..cec5c7d131 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBuildingResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs new file mode 100644 index 0000000000..655cc0881a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs new file mode 100644 index 0000000000..efb696ec11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs new file mode 100644 index 0000000000..f0f2d916b4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateCyclePathRequest.cs new file mode 100644 index 0000000000..308bc4facb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateDistrictRequest.cs new file mode 100644 index 0000000000..77a20888c0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateDistrictRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..edd88ebba0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs new file mode 100644 index 0000000000..441eceef39 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..6c65cfb4f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs new file mode 100644 index 0000000000..07f8a426a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs new file mode 100644 index 0000000000..a58ad49e5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoadRequest.cs new file mode 100644 index 0000000000..37c37f4572 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoadRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs new file mode 100644 index 0000000000..3fd3ee76d8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateStaffMemberRequest.cs new file mode 100644 index 0000000000..8034b3e20d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateStaffMemberRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs new file mode 100644 index 0000000000..abcd4e2074 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCyclePathResponse.cs new file mode 100644 index 0000000000..366e871404 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInDistrictResponse.cs new file mode 100644 index 0000000000..9379e911da --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInDistrictResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs new file mode 100644 index 0000000000..4e6eee24ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInKitchenResponse.cs new file mode 100644 index 0000000000..f2f0ef9ac3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs new file mode 100644 index 0000000000..3f28800e7e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInMansionResponse.cs new file mode 100644 index 0000000000..b729a9fde1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInMansionResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInResidenceResponse.cs new file mode 100644 index 0000000000..75f1ed93b9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInResidenceResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoadResponse.cs new file mode 100644 index 0000000000..e9fdc4ae57 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoadResponse.cs @@ -0,0 +1,91 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoomResponse.cs new file mode 100644 index 0000000000..bcacceacf5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoomResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInStaffMemberResponse.cs new file mode 100644 index 0000000000..0581fecac2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInStaffMemberResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInToiletResponse.cs new file mode 100644 index 0000000000..078ebec90c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBathroomRequest.cs new file mode 100644 index 0000000000..1c21c30ada --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBedroomRequest.cs new file mode 100644 index 0000000000..100afbc623 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..a665515864 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateCyclePathRequest.cs new file mode 100644 index 0000000000..640b86b7d9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateDistrictRequest.cs new file mode 100644 index 0000000000..6c0c9ae9fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateDistrictRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..0e72321271 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateKitchenRequest.cs new file mode 100644 index 0000000000..8e8ecb22ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateLivingRoomRequest.cs new file mode 100644 index 0000000000..a01946a0ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs new file mode 100644 index 0000000000..963601d149 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..227dc7e5c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoadRequest.cs new file mode 100644 index 0000000000..dbdc255dd8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoadRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoomRequest.cs new file mode 100644 index 0000000000..6d768ab716 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoomRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateStaffMemberRequest.cs new file mode 100644 index 0000000000..4244f65037 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateStaffMemberRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateToiletRequest.cs new file mode 100644 index 0000000000..7525a6c1be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DistrictCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DistrictCollectionResponseDocument.cs new file mode 100644 index 0000000000..7766139356 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DistrictCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DistrictCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DistrictCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..d476e9cda8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..5dd14b1cdd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..ac5ec03ee8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..3bac05fc46 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..0e310de4e0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeCollectionResponseDocument.cs new file mode 100644 index 0000000000..6b2bf04584 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public FamilyHomeCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs new file mode 100644 index 0000000000..e0b5fc07e5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..ba86f418d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..1fdd61d52f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,96 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenCollectionResponseDocument.cs new file mode 100644 index 0000000000..1380ce2f96 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public KitchenCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..f1da5bb35a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..ba4007e42f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomCollectionResponseDocument.cs new file mode 100644 index 0000000000..701925f556 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public LivingRoomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..4f89cfa7fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..6cadc432df --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionCollectionResponseDocument.cs new file mode 100644 index 0000000000..eb8354866f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs new file mode 100644 index 0000000000..d538d1b9d7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..6b68d36a0e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/Meta.cs similarity index 63% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/Meta.cs index 60795ec582..0f74d52b58 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/Meta.cs @@ -8,40 +8,41 @@ using System.Collections.Generic; using System.IO; using System; -namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataStreamAttributesInResponse : IBackedModel, IParsable + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The bytesTransmitted property - public long? BytesTransmitted + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { - get { return BackingStore?.Get("bytesTransmitted"); } - set { BackingStore?.Set("bytesTransmitted", value); } + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataStreamAttributesInResponse() + public Meta() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta(); } /// @@ -52,7 +53,6 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "bytesTransmitted", n => { BytesTransmitted = n.GetLongValue(); } }, }; } @@ -63,7 +63,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteLongValue("bytesTransmitted", BytesTransmitted); + writer.WriteAdditionalData(AdditionalData); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..4f0d8343cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..16ea89097e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBathroomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBathroomResponseDocument.cs new file mode 100644 index 0000000000..0a53bb41b2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBathroomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBathroomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBathroomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBedroomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBedroomResponseDocument.cs new file mode 100644 index 0000000000..047a550dc9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBedroomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBedroomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBedroomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs new file mode 100644 index 0000000000..229e7cab38 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBuildingResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBuildingResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs new file mode 100644 index 0000000000..af051ea917 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryCyclePathResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryCyclePathResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryDistrictResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryDistrictResponseDocument.cs new file mode 100644 index 0000000000..5dca10e598 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryDistrictResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryDistrictResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryDistrictResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryFamilyHomeResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryFamilyHomeResponseDocument.cs new file mode 100644 index 0000000000..99e139e5d3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryFamilyHomeResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryFamilyHomeResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryFamilyHomeResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryKitchenResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryKitchenResponseDocument.cs new file mode 100644 index 0000000000..e99ce77690 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryKitchenResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryKitchenResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryKitchenResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryLivingRoomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryLivingRoomResponseDocument.cs new file mode 100644 index 0000000000..f125e86438 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryLivingRoomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryLivingRoomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryLivingRoomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryMansionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryMansionResponseDocument.cs new file mode 100644 index 0000000000..e9a202c5f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryMansionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryMansionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryMansionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryResidenceResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryResidenceResponseDocument.cs new file mode 100644 index 0000000000..0fb5f7ad71 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryResidenceResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryResidenceResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryResidenceResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoadResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoadResponseDocument.cs new file mode 100644 index 0000000000..b2bf2db1d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoadResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryRoadResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryRoadResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoomResponseDocument.cs new file mode 100644 index 0000000000..82def113ea --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryRoomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryRoomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryStaffMemberResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryStaffMemberResponseDocument.cs new file mode 100644 index 0000000000..f841d26997 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryStaffMemberResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryStaffMemberResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryStaffMemberResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryToiletResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryToiletResponseDocument.cs new file mode 100644 index 0000000000..c67dbdc7d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryToiletResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryToiletResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryToiletResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..edb075fccd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs new file mode 100644 index 0000000000..8352aee801 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs new file mode 100644 index 0000000000..91574b4c30 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs new file mode 100644 index 0000000000..cf37d2ec1b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs @@ -0,0 +1,57 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs new file mode 100644 index 0000000000..737a5b70f8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs new file mode 100644 index 0000000000..4419001c73 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs new file mode 100644 index 0000000000..e79429baef --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateCyclePathRequest.cs new file mode 100644 index 0000000000..5ac47d4ef0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateDistrictRequest.cs new file mode 100644 index 0000000000..f69df43062 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateDistrictRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..80e5e94f80 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs new file mode 100644 index 0000000000..184853c913 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..36c8ec0bf2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs new file mode 100644 index 0000000000..8c59f6a798 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..a95af47983 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs new file mode 100644 index 0000000000..c97a7af201 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoadRequest.cs new file mode 100644 index 0000000000..e57864b7da --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoadRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs new file mode 100644 index 0000000000..cb5fba02f9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs new file mode 100644 index 0000000000..f0e53f3077 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs new file mode 100644 index 0000000000..09ab4df065 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInDistrictResponse.cs new file mode 100644 index 0000000000..dc60b22687 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInDistrictResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs new file mode 100644 index 0000000000..a879fb7031 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs new file mode 100644 index 0000000000..98398c4035 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs new file mode 100644 index 0000000000..9655f86fb6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs new file mode 100644 index 0000000000..fcd806b8d1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs new file mode 100644 index 0000000000..cb46857698 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..94c2c64322 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoadResponse.cs new file mode 100644 index 0000000000..67d482e841 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoadResponse.cs @@ -0,0 +1,55 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs new file mode 100644 index 0000000000..9cde803fb7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs new file mode 100644 index 0000000000..c4d5ceaa2f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBathroomRequest.cs new file mode 100644 index 0000000000..aab9b0b08c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBedroomRequest.cs new file mode 100644 index 0000000000..1e6b84cb27 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..e88c23c337 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateCyclePathRequest.cs new file mode 100644 index 0000000000..259d5aacfc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateDistrictRequest.cs new file mode 100644 index 0000000000..1eed06645d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateDistrictRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..f480dcbdbd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateKitchenRequest.cs new file mode 100644 index 0000000000..d48b9e70ea --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateLivingRoomRequest.cs new file mode 100644 index 0000000000..f63f0c619f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs new file mode 100644 index 0000000000..7e8a5f52ee --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..1f9bdce3dc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..e9b4cc7a4d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoadRequest.cs new file mode 100644 index 0000000000..143c62ec6f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoadRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoomRequest.cs new file mode 100644 index 0000000000..2e3173d1fe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateToiletRequest.cs new file mode 100644 index 0000000000..80c56ae480 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceCollectionResponseDocument.cs new file mode 100644 index 0000000000..8cb16dfb26 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs new file mode 100644 index 0000000000..b0bdf82a9f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..2d7d1bac29 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs new file mode 100644 index 0000000000..5e85183b85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..1f06ec35c7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..170ee686d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..2e16fdce5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..34d11a9811 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..89478f5840 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..05536ed7be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceLinks.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceLinks.cs index 0f83b21a71..d0c613c121 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceLinks.cs @@ -8,27 +8,27 @@ using System.Collections.Generic; using System.IO; using System; -namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AccommodationAttributesInResponse : IBackedModel, IParsable + public partial class ResourceLinks : IBackedModel, IParsable #pragma warning restore CS1591 { - /// The address property - public string? Address - { - get { return BackingStore?.Get("address"); } - set { BackingStore?.Set("address", value); } - } - /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public AccommodationAttributesInResponse() + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -36,12 +36,12 @@ public AccommodationAttributesInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks(); } /// @@ -52,7 +52,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "address", n => { Address = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, }; } @@ -63,7 +63,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteStringValue("address", Address); + writer.WriteStringValue("self", Self); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..c0cd803664 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..069b5a875b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "districts")] + #pragma warning disable CS1591 + Districts, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadCollectionResponseDocument.cs new file mode 100644 index 0000000000..bd41c2a83f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..13c9b3b1b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInRequest.cs new file mode 100644 index 0000000000..221e23a4fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInResponse.cs new file mode 100644 index 0000000000..439d90b774 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadResourceType.cs new file mode 100644 index 0000000000..7ff194472c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoadResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomCollectionResponseDocument.cs new file mode 100644 index 0000000000..aab3e24817 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..8db59f0d81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..35d91313ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..bd2edf44f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..3b43c0ea15 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/SecondaryResidenceResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/SecondaryResidenceResponseDocument.cs new file mode 100644 index 0000000000..f2e4343706 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/SecondaryResidenceResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class SecondaryResidenceResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public SecondaryResidenceResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberCollectionResponseDocument.cs new file mode 100644 index 0000000000..9c3ea492ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..f8a7cfbd82 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..1b4a907768 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..62883644c0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberResourceType.cs similarity index 63% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelResourceType.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberResourceType.cs index a7ac81148c..80be2f02de 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelResourceType.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberResourceType.cs @@ -3,16 +3,16 @@ #pragma warning disable CS8625 using System.Runtime.Serialization; using System; -namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public enum WriteOnlyChannelResourceType + public enum StaffMemberResourceType #pragma warning restore CS1591 { - [EnumMember(Value = "writeOnlyChannels")] + [EnumMember(Value = "staffMembers")] #pragma warning disable CS1591 - WriteOnlyChannels, + StaffMembers, #pragma warning restore CS1591 } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInRequest.cs new file mode 100644 index 0000000000..036073ef95 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInResponse.cs new file mode 100644 index 0000000000..13c72202ae --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInRequest.cs new file mode 100644 index 0000000000..7069db6687 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInResponse.cs new file mode 100644 index 0000000000..165e536a50 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..c2dea650f2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInResponse.cs new file mode 100644 index 0000000000..10acdbcdb9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..ff897a120b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs new file mode 100644 index 0000000000..c331bec45f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs new file mode 100644 index 0000000000..3b3ccf027a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs new file mode 100644 index 0000000000..1cca5438d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletCollectionResponseDocument.cs new file mode 100644 index 0000000000..b731297e9b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToiletCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..08c1fe8100 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..a35a5c20cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBathroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBathroomRequestDocument.cs new file mode 100644 index 0000000000..726afad270 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBathroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBathroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBathroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBedroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBedroomRequestDocument.cs new file mode 100644 index 0000000000..c78736d1c4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBedroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBedroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBedroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBuildingRequestDocument.cs new file mode 100644 index 0000000000..ffe2b9ed67 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateCyclePathRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateCyclePathRequestDocument.cs new file mode 100644 index 0000000000..a217f3c240 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateCyclePathRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateCyclePathRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateCyclePathRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateDistrictRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateDistrictRequestDocument.cs new file mode 100644 index 0000000000..ed0e71615f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateDistrictRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateDistrictRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateDistrictRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateFamilyHomeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateFamilyHomeRequestDocument.cs new file mode 100644 index 0000000000..c4a9b7c3f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateFamilyHomeRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateFamilyHomeRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateFamilyHomeRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateKitchenRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateKitchenRequestDocument.cs new file mode 100644 index 0000000000..0959023ce2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateKitchenRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateKitchenRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateKitchenRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateLivingRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateLivingRoomRequestDocument.cs new file mode 100644 index 0000000000..16ff2af485 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateLivingRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateLivingRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateLivingRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateMansionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateMansionRequestDocument.cs new file mode 100644 index 0000000000..6202763be1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateMansionRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateMansionRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateResidenceRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateResidenceRequestDocument.cs new file mode 100644 index 0000000000..2886cdaade --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateResidenceRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateResidenceRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateResidenceRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoadRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoadRequestDocument.cs new file mode 100644 index 0000000000..98949c3fdc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoadRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoadRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateRoadRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoomRequestDocument.cs new file mode 100644 index 0000000000..986853bf88 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateStaffMemberRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateStaffMemberRequestDocument.cs new file mode 100644 index 0000000000..92032d0115 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateStaffMemberRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateStaffMemberRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateStaffMemberRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateToiletRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateToiletRequestDocument.cs new file mode 100644 index 0000000000..6ff7e5eb43 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateToiletRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateToiletRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateToiletRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/NoOperationsInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/NoOperationsInheritanceClient.cs new file mode 100644 index 0000000000..671f89ce4b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/NoOperationsInheritanceClient.cs @@ -0,0 +1,152 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NoOperationsInheritanceClient : BaseRequestBuilder + { + /// The bathrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder Bathrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The bedrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder Bedrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The cyclePaths property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder CyclePaths + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The districts property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder Districts + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The familyHomes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder FamilyHomes + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The kitchens property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder Kitchens + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder(PathParameters, RequestAdapter); + } + + /// The livingRooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder LivingRooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The mansions property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder Mansions + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The operations property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residences property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder Residences + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staffMembers property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder StaffMembers + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder(PathParameters, RequestAdapter); + } + + /// The toilets property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder Toilets + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public NoOperationsInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..dd67d2c937 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations +{ + /// + /// Builds and executes requests for operations under \operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..3af9fe3880 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..c7d5273362 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs new file mode 100644 index 0000000000..cca0332c9e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item +{ + /// + /// Builds and executes requests for operations under \residences\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing residence by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual residence by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing residence. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing residence by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual residence by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual residence by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing residence. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..855e716c4e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms +{ + /// + /// Builds and executes requests for operations under \residences\{id}\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related rooms of an individual residence's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related rooms of an individual residence's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related rooms of an individual residence's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/ResidencesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/ResidencesRequestBuilder.cs new file mode 100644 index 0000000000..c3d052fc9c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/ResidencesRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences +{ + /// + /// Builds and executes requests for operations under \residences + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.residences.item collection + /// The identifier of the residence to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of residences. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new residence. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of residences. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of residences. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new residence. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/Item/RoadsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/Item/RoadsItemRequestBuilder.cs new file mode 100644 index 0000000000..a7f4fb2f39 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/Item/RoadsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item +{ + /// + /// Builds and executes requests for operations under \roads\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing road by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual road by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing road. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing road by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual road by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing road. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual road by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing road. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..183c993c2d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads +{ + /// + /// Builds and executes requests for operations under \roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.roads.item collection + /// The identifier of the road to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of roads. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new road. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of roads. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new road. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of roads. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new road. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..eb1ede6779 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..709d7eed62 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..c204476e01 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual room's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual room's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual room's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..3d79d4361e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item +{ + /// + /// Builds and executes requests for operations under \rooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing room by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual room by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing room. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing room by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual room by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual room by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing room. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..d94b753ccb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms +{ + /// + /// Builds and executes requests for operations under \rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.rooms.item collection + /// The identifier of the room to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of rooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new room. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of rooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of rooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new room. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/Item/StaffMembersItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/Item/StaffMembersItemRequestBuilder.cs new file mode 100644 index 0000000000..49a8467e6d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/Item/StaffMembersItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item +{ + /// + /// Builds and executes requests for operations under \staffMembers\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffMembersItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffMembersItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing staffMember by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual staffMember by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing staffMember. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing staffMember by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual staffMember by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing staffMember. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual staffMember by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing staffMember. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/StaffMembersRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/StaffMembersRequestBuilder.cs new file mode 100644 index 0000000000..0401dfc38d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/StaffMembersRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers +{ + /// + /// Builds and executes requests for operations under \staffMembers + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.staffMembers.item collection + /// The identifier of the staffMember to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffMembersRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffMembersRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of staffMembers. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new staffMember. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of staffMembers. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new staffMember. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of staffMembers. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new staffMember. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..a49d8d42db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..cfb0d5a17e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..10551d094c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual toilet's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual toilet's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual toilet's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs new file mode 100644 index 0000000000..e39bd675f1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item +{ + /// + /// Builds and executes requests for operations under \toilets\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing toilet by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual toilet by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing toilet. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing toilet by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual toilet by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual toilet by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing toilet. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/ToiletsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/ToiletsRequestBuilder.cs new file mode 100644 index 0000000000..714b2e4833 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/ToiletsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets +{ + /// + /// Builds and executes requests for operations under \toilets + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.toilets.item collection + /// The identifier of the toilet to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of toilets. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new toilet. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of toilets. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of toilets. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new toilet. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs new file mode 100644 index 0000000000..7c93ad95cb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs @@ -0,0 +1,961 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.NoOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations; + +public sealed class ResourceInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public ResourceInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_abstract_endpoint() + { + // Arrange + Residence residence = _fakers.Residence.GenerateOne(); + Mansion mansion = _fakers.Mansion.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(residence, mansion, familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + BuildingCollectionResponseDocument? response = await apiClient.Buildings.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(3); + + response.Data.OfType().Should().ContainSingle(data => data.Id == residence.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == mansion.StringId).Subject.With(data => + { + AttributesInMansionResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == familyHome.StringId).Subject.With(data => + { + AttributesInFamilyHomeResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_base_endpoint() + { + // Arrange + Road road = _fakers.Road.GenerateOne(); + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Roads.AddRange(road, cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + RoadCollectionResponseDocument? response = await apiClient.Roads.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == road.StringId).Subject.With(data => + { + AttributesInRoadResponse? attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(road.LengthInMeters); + + data.Relationships.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == cyclePath.StringId).Subject.With(data => + { + AttributesInCyclePathResponse attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + + data.Relationships.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome1 = _fakers.FamilyHome.GenerateOne(); + FamilyHome familyHome2 = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(familyHome1, familyHome2); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + FamilyHomeCollectionResponseDocument? response = await apiClient.FamilyHomes.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == familyHome1.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome1.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome1.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.Should().ContainSingle(data => data.Id == familyHome2.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome2.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome2.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_abstract_endpoint() + { + // Arrange + Mansion mansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings[mansion.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(mansion.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_base_endpoint() + { + // Arrange + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + PrimaryRoadResponseDocument? response = await apiClient.Roads[cyclePath.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(cyclePath.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + }); + + response.Data.Relationships.Should().BeNull(); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + PrimaryFamilyHomeResponseDocument? response = await apiClient.FamilyHomes[familyHome.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(familyHome.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + SecondaryResidenceResponseDocument? response = await apiClient.Rooms[bedroom.StringId!].Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + SecondaryResidenceResponseDocument? response = await apiClient.Bedrooms[bedroom.StringId!].Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + RoomCollectionResponseDocument? response = await apiClient.Residences[familyHome.StringId!].Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId).Subject.With(data => + { + AttributesInKitchenResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(kitchen.SurfaceInSquareMeters); + attributes.HasPantry.Should().Be(kitchen.HasPantry); + + RelationshipsInKitchenResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId).Subject.With(data => + { + AttributesInBedroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bedroom.SurfaceInSquareMeters); + attributes.BedCount.Should().Be(bedroom.BedCount); + + RelationshipsInBedroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + RoomCollectionResponseDocument? response = await apiClient.Mansions[mansion.StringId!].Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId).Subject.With(data => + { + AttributesInBathroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bathroom.SurfaceInSquareMeters); + attributes.HasBath.Should().Be(bathroom.HasBath); + + RelationshipsInBathroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId).Subject.With(data => + { + AttributesInToiletResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(toilet.SurfaceInSquareMeters); + attributes.HasSink.Should().Be(toilet.HasSink); + + RelationshipsInToiletResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_create_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + CreateRoadRequestDocument requestBody = new() + { + Data = new DataInCreateRoadRequest + { + Type = ResourceType.Roads, + Attributes = new AttributesInCreateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = await apiClient.Roads.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + long newRoadId = long.Parse(roadData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(newRoadId); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + CreateBuildingRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInCreateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom1.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom2.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.LivingRooms, + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "rooms" + }); + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + CreateResidenceRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryResidenceResponseDocument? response = await apiClient.Residences.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_update_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + Road existingRoad = _fakers.Road.GenerateOne(); + + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(existingRoad); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + UpdateRoadRequestDocument requestBody = new() + { + Data = new DataInUpdateRoadRequest + { + Type = ResourceType.Roads, + Id = existingRoad.StringId!, + Attributes = new AttributesInUpdateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = await apiClient.Roads[existingRoad.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(existingRoad.Id); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInUpdateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom1.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom2.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.LivingRooms, + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "rooms" + }); + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings[existingFamilyHome.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings[existingFamilyHome.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(1); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == existingFamilyHome.Rooms.ElementAt(0).Id); + }); + } + + [Fact] + public async Task Can_delete_concrete_derived_resource_at_abstract_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + await apiClient.Buildings[existingMansion.StringId!].DeleteAsync(); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome? familyHomeInDatabase = await dbContext.FamilyHomes.FirstWithIdOrDefaultAsync(existingMansion.Id); + + familyHomeInDatabase.Should().BeNull(); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs new file mode 100644 index 0000000000..2faf4d95e9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms +{ + /// + /// Builds and executes requests for operations under \bathrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.bathrooms.item collection + /// The identifier of the bathroom whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..28a422a10a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..3bc2420018 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..176f1eb2bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs new file mode 100644 index 0000000000..5e7e71c07b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms +{ + /// + /// Builds and executes requests for operations under \bedrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.bedrooms.item collection + /// The identifier of the bedroom whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..46ba9a6b3b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..f90a7b878f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..f2e6fdc796 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/DistrictsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/DistrictsRequestBuilder.cs new file mode 100644 index 0000000000..91cd94cb58 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/DistrictsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts +{ + /// + /// Builds and executes requests for operations under \districts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.districts.item collection + /// The identifier of the district whose related building identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder this[Guid position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs new file mode 100644 index 0000000000..a53f2f111f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item +{ + /// + /// Builds and executes requests for operations under \districts\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..2c763350f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", rawUrl) + { + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..8fd8f8bd25 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..327ff7860a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", rawUrl) + { + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs new file mode 100644 index 0000000000..e9c32fdaff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes +{ + /// + /// Builds and executes requests for operations under \familyHomes + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.familyHomes.item collection + /// The identifier of the familyHome whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs new file mode 100644 index 0000000000..ed3b04f708 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..b444317972 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..5db68f23c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs new file mode 100644 index 0000000000..24db678ff1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item +{ + /// + /// Builds and executes requests for operations under \kitchens\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..aad4c41847 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..64e2187053 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/KitchensRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/KitchensRequestBuilder.cs new file mode 100644 index 0000000000..e7bc03280b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/KitchensRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens +{ + /// + /// Builds and executes requests for operations under \kitchens + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.kitchens.item collection + /// The identifier of the kitchen whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..c2e63940f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..a5a20b15ce --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..b93d8e89f8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs new file mode 100644 index 0000000000..3df6c70421 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms +{ + /// + /// Builds and executes requests for operations under \livingRooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.livingRooms.item collection + /// The identifier of the livingRoom whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs new file mode 100644 index 0000000000..e28ea4f657 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item +{ + /// + /// Builds and executes requests for operations under \mansions\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..d1ae8eb805 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder Staff + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..8559c1e418 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs new file mode 100644 index 0000000000..f311818aac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\staff + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", rawUrl) + { + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/MansionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/MansionsRequestBuilder.cs new file mode 100644 index 0000000000..96bb107cec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/MansionsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions +{ + /// + /// Builds and executes requests for operations under \mansions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.mansions.item collection + /// The identifier of the mansion whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddOperationCode.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryResourceType.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddOperationCode.cs index 03934365c1..0e9bbb9331 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryResourceType.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddOperationCode.cs @@ -3,16 +3,16 @@ #pragma warning disable CS8625 using System.Runtime.Serialization; using System; -namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public enum CountryResourceType + public enum AddOperationCode #pragma warning restore CS1591 { - [EnumMember(Value = "countries")] + [EnumMember(Value = "add")] #pragma warning disable CS1591 - Countries, + Add, #pragma warning restore CS1591 } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictBuildingsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictBuildingsRelationshipOperation.cs new file mode 100644 index 0000000000..4143782e3b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictBuildingsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToDistrictBuildingsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictBuildingsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictBuildingsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictRoadsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictRoadsRelationshipOperation.cs new file mode 100644 index 0000000000..491c7bb12c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictRoadsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToDistrictRoadsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictRoadsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictRoadsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..2bcd6624a6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..799fc718e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..763e97fd5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToResidenceRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToResidenceRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..ca2267c9e0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToResidenceRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToResidenceRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..febb9386bc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,107 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "addToDistrictBuildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictBuildingsRelationshipOperation(), + "addToDistrictRoads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictRoadsRelationshipOperation(), + "addToFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(), + "addToMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionRoomsRelationshipOperation(), + "addToMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionStaffRelationshipOperation(), + "addToResidenceRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation(), + "removeFromDistrictBuildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictBuildingsRelationshipOperation(), + "removeFromDistrictRoads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictRoadsRelationshipOperation(), + "removeFromFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromFamilyHomeRoomsRelationshipOperation(), + "removeFromMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(), + "removeFromMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(), + "removeFromResidenceRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation(), + "updateBathroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(), + "updateBedroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(), + "updateDistrictBuildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictBuildingsRelationshipOperation(), + "updateDistrictRoads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictRoadsRelationshipOperation(), + "updateFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateFamilyHomeRoomsRelationshipOperation(), + "updateKitchenResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(), + "updateLivingRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(), + "updateMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionRoomsRelationshipOperation(), + "updateMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionStaffRelationshipOperation(), + "updateResidenceRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation(), + "updateRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(), + "updateToiletResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..7300ca2577 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..c30522c543 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..9c60fb2434 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..bed3610a61 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..fc32f3a944 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..aacdc4d995 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInRequest.cs new file mode 100644 index 0000000000..406132dd44 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..e00c377eb1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..a90cdecac6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInRequest.cs new file mode 100644 index 0000000000..ebcb35eabe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInResponse.cs new file mode 100644 index 0000000000..4d1a6ba08c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipIdentifier.cs new file mode 100644 index 0000000000..477bc183b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictBuildingsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictBuildingsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipName.cs similarity index 63% rename from test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountResourceType.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipName.cs index 9fba68d5ad..40b7f00d41 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountResourceType.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipName.cs @@ -3,16 +3,16 @@ #pragma warning disable CS8625 using System.Runtime.Serialization; using System; -namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public enum SocialMediaAccountResourceType + public enum DistrictBuildingsRelationshipName #pragma warning restore CS1591 { - [EnumMember(Value = "socialMediaAccounts")] + [EnumMember(Value = "buildings")] #pragma warning disable CS1591 - SocialMediaAccounts, + Buildings, #pragma warning restore CS1591 } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictResourceType.cs new file mode 100644 index 0000000000..15cf98cad9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum DistrictResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "districts")] + #pragma warning disable CS1591 + Districts, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipIdentifier.cs new file mode 100644 index 0000000000..bdc96f78bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictRoadsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictRoadsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipName.cs new file mode 100644 index 0000000000..f81f345607 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum DistrictRoadsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..a992df3506 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..27e8c66e17 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..6d1af3228b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..c14aa4fb5f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..250b544f85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs new file mode 100644 index 0000000000..26ec985023 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..829e6af19c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..154dcaf1b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,96 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..29aa2132d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..0898c1303c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..3441c0b18b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..85f205b62c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInRequest.cs new file mode 100644 index 0000000000..4d98aeb73b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..fbd0850f8f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionResourceType.cs new file mode 100644 index 0000000000..487c9d3324 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs new file mode 100644 index 0000000000..427641c710 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionStaffRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionStaffRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipName.cs new file mode 100644 index 0000000000..77cb0a08fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionStaffRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "staff")] + #pragma warning disable CS1591 + Staff, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..6e0ac0995e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..a2dc93bcd8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..3b5d5fed63 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictBuildingsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictBuildingsRelationshipOperation.cs new file mode 100644 index 0000000000..7550cf1801 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictBuildingsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromDistrictBuildingsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictBuildingsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictBuildingsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictRoadsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictRoadsRelationshipOperation.cs new file mode 100644 index 0000000000..0b8f61cd81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictRoadsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromDistrictRoadsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictRoadsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictRoadsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..6b48a1b594 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..325180cab0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..6a93441877 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromResidenceRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromResidenceRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..a095c7e1c6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromResidenceRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromResidenceRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveOperationCode.cs new file mode 100644 index 0000000000..fdce79bec1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RemoveOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "remove")] + #pragma warning disable CS1591 + Remove, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInRequest.cs new file mode 100644 index 0000000000..4c9355ec83 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..a35c6f3285 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs new file mode 100644 index 0000000000..adb0c6d282 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceResourceType.cs new file mode 100644 index 0000000000..c22582634f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResidenceResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipIdentifier.cs new file mode 100644 index 0000000000..8fdf5a9cc5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceRoomsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceRoomsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipName.cs new file mode 100644 index 0000000000..b3d503202b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResidenceRoomsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..591118db9b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..65fc63a1ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..90666b96d8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..a9100614f6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..d2a7100a24 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..c86d306da9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInRequest.cs new file mode 100644 index 0000000000..c9aba1bf9f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInResponse.cs new file mode 100644 index 0000000000..2ecbd9c590 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadResourceType.cs new file mode 100644 index 0000000000..29e51bb24a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoadResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..0269341a9f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..89e413363d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..a1dc140ad3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs new file mode 100644 index 0000000000..0de8196836 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomResidenceRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomResidenceRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipName.cs new file mode 100644 index 0000000000..81c5aee1d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResidenceRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "residence")] + #pragma warning disable CS1591 + Residence, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..673a7a2627 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..a4fa0cac51 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..bdb650701e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..3510ef6d72 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberResourceType.cs new file mode 100644 index 0000000000..0bab511da5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StaffMemberResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyBuildingInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyBuildingInRequest.cs new file mode 100644 index 0000000000..e92d08b38b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyBuildingInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoadInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoadInRequest.cs new file mode 100644 index 0000000000..bc28c2046e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoadInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..6d86a46351 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..f3c2657bb4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToOneResidenceInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToOneResidenceInRequest.cs new file mode 100644 index 0000000000..35ec5e1481 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToOneResidenceInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..ef9987c75e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..b2b4b5e49e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..eba920be53 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBathroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..5a33375f85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBedroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictBuildingsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictBuildingsRelationshipOperation.cs new file mode 100644 index 0000000000..fbffe5563f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictBuildingsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateDistrictBuildingsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictBuildingsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictBuildingsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictRoadsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictRoadsRelationshipOperation.cs new file mode 100644 index 0000000000..11ec569385 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictRoadsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateDistrictRoadsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictRoadsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictRoadsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..85d83cd7e1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..4201ad673f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateKitchenResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..88d038fea0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateLivingRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..3936393248 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..b90a70b240 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateOperationCode.cs new file mode 100644 index 0000000000..0145d31557 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UpdateOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "update")] + #pragma warning disable CS1591 + Update, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateResidenceRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateResidenceRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..9e339cc0e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateResidenceRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateResidenceRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..c519144898 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..9d9f1a527f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateToiletResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/OnlyRelationshipsInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/OnlyRelationshipsInheritanceClient.cs new file mode 100644 index 0000000000..12057ec348 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/OnlyRelationshipsInheritanceClient.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OnlyRelationshipsInheritanceClient : BaseRequestBuilder + { + /// The bathrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.BathroomsRequestBuilder Bathrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.BathroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The bedrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.BedroomsRequestBuilder Bedrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.BedroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The districts property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.DistrictsRequestBuilder Districts + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.DistrictsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The familyHomes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder FamilyHomes + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The kitchens property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.KitchensRequestBuilder Kitchens + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.KitchensRequestBuilder(PathParameters, RequestAdapter); + } + + /// The livingRooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder LivingRooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The mansions property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.MansionsRequestBuilder Mansions + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.MansionsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The operations property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residences property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.ResidencesRequestBuilder Residences + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.ResidencesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The toilets property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.ToiletsRequestBuilder Toilets + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.ToiletsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public OnlyRelationshipsInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..7bbb822cfc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations +{ + /// + /// Builds and executes requests for operations under \operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..ca1fbcf640 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..4791a55075 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs new file mode 100644 index 0000000000..0460573b86 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item +{ + /// + /// Builds and executes requests for operations under \residences\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/ResidencesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/ResidencesRequestBuilder.cs new file mode 100644 index 0000000000..5dd0f2107e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/ResidencesRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences +{ + /// + /// Builds and executes requests for operations under \residences + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.residences.item collection + /// The identifier of the residence whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..c2bf625624 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..b6c5f16374 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..3dd1f57547 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item +{ + /// + /// Builds and executes requests for operations under \rooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..ff88914623 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms +{ + /// + /// Builds and executes requests for operations under \rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.rooms.item collection + /// The identifier of the room whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..87db76543d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..70ceef10dc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs new file mode 100644 index 0000000000..9cb2ac94af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item +{ + /// + /// Builds and executes requests for operations under \toilets\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/ToiletsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/ToiletsRequestBuilder.cs new file mode 100644 index 0000000000..6e4af346e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/ToiletsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets +{ + /// + /// Builds and executes requests for operations under \toilets + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.toilets.item collection + /// The identifier of the toilet whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs new file mode 100644 index 0000000000..51ce915018 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs @@ -0,0 +1,913 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.OnlyRelationships; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships; + +public sealed class RelationshipInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public RelationshipInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + // GET /rooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + ResidenceIdentifierResponseDocument? response = await apiClient.Rooms[bedroom.StringId!].Relationships.Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /bedrooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + ResidenceIdentifierResponseDocument? response = await apiClient.Bedrooms[bedroom.StringId!].Relationships.Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /residences/1/relationships/rooms => [kitchen, bedroom] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + RoomIdentifierCollectionResponseDocument? response = await apiClient.Residences[familyHome.StringId!].Relationships.Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId); + } + + // GET /mansions/1/relationships/rooms => [bathroom, toilet] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + RoomIdentifierCollectionResponseDocument? response = await apiClient.Mansions[mansion.StringId!].Relationships.Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId); + } + + // PATCH /rooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Type = ResourceType.Residences, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Rooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /rooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Type = ResourceType.Mansions, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Rooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Type = ResourceType.Residences, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Bathrooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Type = ResourceType.Mansions, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Bathrooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // DELETE /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddOperationCode.cs similarity index 66% rename from test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationResourceType.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddOperationCode.cs index 3ea65cb715..819a6719fa 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationResourceType.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddOperationCode.cs @@ -3,16 +3,16 @@ #pragma warning disable CS8625 using System.Runtime.Serialization; using System; -namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public enum VacationResourceType + public enum AddOperationCode #pragma warning restore CS1591 { - [EnumMember(Value = "vacations")] + [EnumMember(Value = "add")] #pragma warning disable CS1591 - Vacations, + Add, #pragma warning restore CS1591 } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..9122113872 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..533529ecb9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,104 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "addBathroom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBathroomOperation(), + "addBedroom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBedroomOperation(), + "addFamilyHome" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateFamilyHomeOperation(), + "addKitchen" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateKitchenOperation(), + "addLivingRoom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateLivingRoomOperation(), + "addMansion" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateMansionOperation(), + "addResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation(), + "addRoom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation(), + "addToFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(), + "addToilet" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateToiletOperation(), + "removeFromMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(), + "removeFromMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(), + "updateBathroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(), + "updateBedroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(), + "updateFamilyHome" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateFamilyHomeOperation(), + "updateKitchenResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(), + "updateLivingRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(), + "updateMansion" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateMansionOperation(), + "updateResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation(), + "updateRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(), + "updateToiletResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..189db8df34 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs new file mode 100644 index 0000000000..98f9ccbb28 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs new file mode 100644 index 0000000000..e5affa67a8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs new file mode 100644 index 0000000000..b0b3b0e1e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs new file mode 100644 index 0000000000..a091d48395 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs new file mode 100644 index 0000000000..854cf0e850 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs new file mode 100644 index 0000000000..e8214666de --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..fc292a733a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs new file mode 100644 index 0000000000..892c3668ca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..f53b83cdf3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs new file mode 100644 index 0000000000..c1e61f73fc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..0ce7fd18a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs new file mode 100644 index 0000000000..ff14472361 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs new file mode 100644 index 0000000000..1dbc602b9b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs new file mode 100644 index 0000000000..03ecd3ccd4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs new file mode 100644 index 0000000000..e91dda6c0f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs new file mode 100644 index 0000000000..25243a6e64 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs new file mode 100644 index 0000000000..2f94318bc6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInMansionResponse.cs new file mode 100644 index 0000000000..3035f0a06f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs new file mode 100644 index 0000000000..7478c31f8d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..7947bafc0d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInRoomResponse.cs new file mode 100644 index 0000000000..1565e0301b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInToiletResponse.cs new file mode 100644 index 0000000000..3b313fe0d8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInToiletResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..71c24d37b1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..e40e228f61 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs new file mode 100644 index 0000000000..64431ad387 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..9471064dd5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..439b6e3db1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..aa77201377 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..e3c01d0ca0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..3f5ea328d1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..192d06f0a6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs new file mode 100644 index 0000000000..71fbaef20d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..43b3757972 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..1101a8853d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBathroomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBathroomOperation.cs new file mode 100644 index 0000000000..1dc8648c8d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBathroomOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBathroomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBathroomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBathroomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBedroomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBedroomOperation.cs new file mode 100644 index 0000000000..0bd80b987b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBedroomOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBedroomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBedroomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBedroomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateFamilyHomeOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateFamilyHomeOperation.cs new file mode 100644 index 0000000000..4ac8dd7275 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateFamilyHomeOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateFamilyHomeOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateFamilyHomeOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateFamilyHomeOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateKitchenOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateKitchenOperation.cs new file mode 100644 index 0000000000..5109ac68e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateKitchenOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateKitchenOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateKitchenOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateKitchenOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateLivingRoomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateLivingRoomOperation.cs new file mode 100644 index 0000000000..7dc4a8c470 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateLivingRoomOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateLivingRoomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateLivingRoomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateLivingRoomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateMansionOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateMansionOperation.cs new file mode 100644 index 0000000000..62cbfe268b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateMansionOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateMansionOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateMansionOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateMansionOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateResidenceOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateResidenceOperation.cs new file mode 100644 index 0000000000..45d0ca7632 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateResidenceOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateResidenceOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateRoomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateRoomOperation.cs new file mode 100644 index 0000000000..5d4b82e81c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateRoomOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateRoomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateToiletOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateToiletOperation.cs new file mode 100644 index 0000000000..e141dcf45c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateToiletOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateToiletOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateToiletOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateToiletOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBathroomResponse.cs new file mode 100644 index 0000000000..209e60e20c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBedroomResponse.cs new file mode 100644 index 0000000000..b9c0185eb1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBuildingResponse.cs new file mode 100644 index 0000000000..47dbd2fd41 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBuildingResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs new file mode 100644 index 0000000000..081b74e99c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs new file mode 100644 index 0000000000..537a8cca38 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs new file mode 100644 index 0000000000..5f489f6974 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..96e4076338 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs new file mode 100644 index 0000000000..6c15e646ab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..ae7e7358ba --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs new file mode 100644 index 0000000000..8c8be64e13 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs new file mode 100644 index 0000000000..24059018f0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs new file mode 100644 index 0000000000..bb8415c42f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs new file mode 100644 index 0000000000..ebe9e9e410 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs new file mode 100644 index 0000000000..87c8905d40 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInKitchenResponse.cs new file mode 100644 index 0000000000..b8fb9a81b5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs new file mode 100644 index 0000000000..58e824d1a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInMansionResponse.cs new file mode 100644 index 0000000000..f66ac6f6cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInMansionResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInResidenceResponse.cs new file mode 100644 index 0000000000..e6af095df7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInResidenceResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInRoomResponse.cs new file mode 100644 index 0000000000..69349b71c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInRoomResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInToiletResponse.cs new file mode 100644 index 0000000000..e935922e06 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..ac5872448d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..c8a964a981 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs new file mode 100644 index 0000000000..2298f480bd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..59e28a79c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..63f0f363e0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..bc37ec172f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..6510f5a96b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..ec82e2fa2d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..2cf0cf3b8b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs new file mode 100644 index 0000000000..d97a11846a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..8e2679ad47 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeResourceType.cs new file mode 100644 index 0000000000..137d5442b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum FamilyHomeResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipIdentifier.cs new file mode 100644 index 0000000000..39c141405a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeRoomsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public FamilyHomeRoomsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipName.cs new file mode 100644 index 0000000000..7429d6b60c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum FamilyHomeRoomsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..41f6b2aca0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..7da663f22c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..42521bcf2a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..831828e8ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..c4d0e79170 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs new file mode 100644 index 0000000000..bb3e3158a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..f2d27f433d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionResourceType.cs new file mode 100644 index 0000000000..caf0b5404d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipIdentifier.cs new file mode 100644 index 0000000000..b48f1b49c2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionRoomsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionRoomsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipName.cs new file mode 100644 index 0000000000..1a8e469550 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionRoomsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs new file mode 100644 index 0000000000..4dfc858ac1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionStaffRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionStaffRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipName.cs new file mode 100644 index 0000000000..ec44953c88 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionStaffRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "staff")] + #pragma warning disable CS1591 + Staff, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..1ea6ae9e08 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..7b082fd130 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..b0289c2a4d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..b46e93f5db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs new file mode 100644 index 0000000000..7fee235be0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs new file mode 100644 index 0000000000..ad3b9d40cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs new file mode 100644 index 0000000000..086834d097 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs @@ -0,0 +1,57 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs new file mode 100644 index 0000000000..75fc9b1208 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs new file mode 100644 index 0000000000..7cab1ca126 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs new file mode 100644 index 0000000000..50a24dcd76 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..bd4c3254f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs new file mode 100644 index 0000000000..677c53110f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..a9158cc843 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs new file mode 100644 index 0000000000..77308a0713 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..745beda79a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs new file mode 100644 index 0000000000..b6eab58938 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs new file mode 100644 index 0000000000..3f2865ba35 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs new file mode 100644 index 0000000000..606836ab3d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs new file mode 100644 index 0000000000..ad5618acc3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs new file mode 100644 index 0000000000..58ef29ab15 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs new file mode 100644 index 0000000000..0e1b08055a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs new file mode 100644 index 0000000000..f34735a430 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs new file mode 100644 index 0000000000..4f3e9acd8b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..071fede4a7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs new file mode 100644 index 0000000000..16c3c2ea1f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs new file mode 100644 index 0000000000..55e9808d2b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..e085a94a4c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..ba2117d3ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs new file mode 100644 index 0000000000..ec72193d54 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..f27b90a2cf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..0188f28d4a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..8fa3b08883 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..80ab4892b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveOperationCode.cs new file mode 100644 index 0000000000..aba5993194 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RemoveOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "remove")] + #pragma warning disable CS1591 + Remove, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs new file mode 100644 index 0000000000..893c562a14 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..934cf9c434 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..7f596adfe4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..9476d7c9a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..f9fc29941b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceLinks.cs similarity index 65% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceLinks.cs index 424af5c090..ee38acc9b8 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceLinks.cs @@ -8,27 +8,27 @@ using System.Collections.Generic; using System.IO; using System; -namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerGroupAttributesInResponse : IBackedModel, IParsable + public partial class ResourceLinks : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } - /// The name property - public string? Name + /// The self property + public string? Self { - get { return BackingStore?.Get("name"); } - set { BackingStore?.Set("name", value); } + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public PlayerGroupAttributesInResponse() + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -36,12 +36,12 @@ public PlayerGroupAttributesInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks(); } /// @@ -52,7 +52,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "name", n => { Name = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, }; } @@ -63,7 +63,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteStringValue("name", Name); + writer.WriteStringValue("self", Self); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..fd38a0604f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..b5b42b8b81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,58 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..021f76a3a6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..60a3ac6234 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs new file mode 100644 index 0000000000..73755a5e9e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomResidenceRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomResidenceRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipName.cs new file mode 100644 index 0000000000..b10e9bf6df --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResidenceRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "residence")] + #pragma warning disable CS1591 + Residence, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..b9aff9a41e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..25b9db0424 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..a6ef6ac879 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberResourceType.cs new file mode 100644 index 0000000000..7dbd4afb02 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StaffMemberResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..352d3e295b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInResponse.cs new file mode 100644 index 0000000000..8800c48c80 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..94cc664f89 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs new file mode 100644 index 0000000000..1e0521601c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs new file mode 100644 index 0000000000..132fca3262 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs new file mode 100644 index 0000000000..258a4c16eb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..f02b763d60 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..7b02759616 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..37aeb3e0fd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBathroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..96fa8dc04e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBedroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateFamilyHomeOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateFamilyHomeOperation.cs new file mode 100644 index 0000000000..23ce1283ae --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateFamilyHomeOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateFamilyHomeOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateFamilyHomeOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateFamilyHomeOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..0feb395978 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateKitchenResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..eb085bde37 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateLivingRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateMansionOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateMansionOperation.cs new file mode 100644 index 0000000000..0e9c20fc91 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateMansionOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateMansionOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateMansionOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateOperationCode.cs new file mode 100644 index 0000000000..44e69148e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UpdateOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "update")] + #pragma warning disable CS1591 + Update, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateResidenceOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateResidenceOperation.cs new file mode 100644 index 0000000000..b14a3e002b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateResidenceOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateResidenceOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..5e9d650f72 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..18fc32b6d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateToiletResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..32b762f738 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations +{ + /// + /// Builds and executes requests for operations under \operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/SubsetOfOperationsInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/SubsetOfOperationsInheritanceClient.cs new file mode 100644 index 0000000000..f5764b4205 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/SubsetOfOperationsInheritanceClient.cs @@ -0,0 +1,54 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SubsetOfOperationsInheritanceClient : BaseRequestBuilder + { + /// The operations property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public SubsetOfOperationsInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs new file mode 100644 index 0000000000..3acddac8f6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs @@ -0,0 +1,352 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations; + +public sealed class OperationsInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public OperationsInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_use_inheritance_at_operations_endpoint() + { + // Arrange + StaffMember existingStaffMember = _fakers.StaffMember.GenerateOne(); + + Mansion newMansion = _fakers.Mansion.GenerateOne(); + Kitchen newKitchen = _fakers.Kitchen.GenerateOne(); + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + Bedroom newBedroom = _fakers.Bedroom.GenerateOne(); + int? newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.StaffMembers.Add(existingStaffMember); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new SubsetOfOperationsInheritanceClient(requestAdapter); + + const string mansionLid = "mansion-lid"; + const string kitchenLid = "kitchen-lid"; + const string familyHomeLid = "family-home-lid"; + const string bedroomLid = "bedroom-lid"; + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + // NOTE: CreateBuildingOperation is not generated, because it is turned off. + new CreateResidenceOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateMansionRequest + { + Type = ResourceType.Mansions, + Lid = mansionLid, + Attributes = new AttributesInCreateMansionRequest + { + SurfaceInSquareMeters = newMansion.SurfaceInSquareMeters!.Value, + NumberOfResidents = newMansion.NumberOfResidents!.Value, + OwnerName = newMansion.OwnerName + }, + Relationships = new RelationshipsInCreateMansionRequest + { + Staff = new ToManyStaffMemberInRequest + { + Data = + [ + new StaffMemberIdentifierInRequest + { + Type = ResourceType.StaffMembers, + Id = existingStaffMember.StringId + } + ] + } + } + } + }, + // NOTE: It is possible to create an operation for abstract type. + new CreateRoomOperation + { + Op = AddOperationCode.Add, + // NOTE: DataInCreateRoomRequest is generated, but as abstract type. + Data = new DataInCreateKitchenRequest + { + Type = ResourceType.Kitchens, + Lid = kitchenLid, + Attributes = new AttributesInCreateKitchenRequest + { + SurfaceInSquareMeters = newKitchen.SurfaceInSquareMeters!.Value, + HasPantry = newKitchen.HasPantry!.Value + }, + Relationships = new RelationshipsInCreateKitchenRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Type = ResourceType.Mansions, + Lid = mansionLid + } + } + } + } + }, + new CreateFamilyHomeOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Lid = familyHomeLid, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }, + new CreateBedroomOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateBedroomRequest + { + Type = ResourceType.Bedrooms, + Lid = bedroomLid, + Attributes = new AttributesInCreateBedroomRequest + { + SurfaceInSquareMeters = newBedroom.SurfaceInSquareMeters!.Value, + BedCount = newBedroom.BedCount!.Value + }, + Relationships = new RelationshipsInCreateBedroomRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new FamilyHomeIdentifierInRequest + { + Type = ResourceType.FamilyHomes, + Lid = familyHomeLid + } + } + } + } + }, + new AddToFamilyHomeRoomsRelationshipOperation + { + Op = AddOperationCode.Add, + Ref = new FamilyHomeRoomsRelationshipIdentifier + { + Type = FamilyHomeResourceType.FamilyHomes, + Relationship = FamilyHomeRoomsRelationshipName.Rooms, + Lid = familyHomeLid + }, + Data = + [ + new KitchenIdentifierInRequest + { + Type = ResourceType.Kitchens, + Lid = kitchenLid + } + ] + }, + new UpdateResidenceOperation + { + Op = UpdateOperationCode.Update, + // NOTE: Can use Ref to base type, while Data is derived. + Ref = new ResidenceIdentifierInRequest + { + Type = ResourceType.Residences, + Lid = familyHomeLid + }, + Data = new DataInUpdateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Lid = familyHomeLid, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + }, + new RemoveFromMansionStaffRelationshipOperation + { + Op = RemoveOperationCode.Remove, + Ref = new MansionStaffRelationshipIdentifier + { + Type = MansionResourceType.Mansions, + Relationship = MansionStaffRelationshipName.Staff, + Lid = mansionLid + }, + Data = [] + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + response.AtomicResults.Should().HaveCount(7); + + DataInMansionResponse mansionData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Subject; + AttributesInMansionResponse mansionAttributes = mansionData.Attributes.Should().BeOfType().Subject; + mansionAttributes.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionAttributes.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionAttributes.OwnerName.Should().Be(newMansion.OwnerName); + mansionData.Relationships.Should().BeNull(); + + DataInKitchenResponse kitchenData = response.AtomicResults.ElementAt(1).Data.Should().BeOfType().Subject; + AttributesInKitchenResponse kitchenAttributes = kitchenData.Attributes.Should().BeOfType().Subject; + kitchenAttributes.SurfaceInSquareMeters.Should().Be(newKitchen.SurfaceInSquareMeters); + kitchenAttributes.HasPantry.Should().Be(newKitchen.HasPantry); + kitchenData.Relationships.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData2 = response.AtomicResults.ElementAt(2).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes2 = familyHomeData2.Attributes.Should().BeOfType().Subject; + familyHomeAttributes2.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes2.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes2.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData2.Relationships.Should().BeNull(); + + DataInBedroomResponse bedroomData = response.AtomicResults.ElementAt(3).Data.Should().BeOfType().Subject; + AttributesInBedroomResponse bedroomAttributes = bedroomData.Attributes.Should().BeOfType().Subject; + bedroomAttributes.SurfaceInSquareMeters.Should().Be(newBedroom.SurfaceInSquareMeters); + bedroomAttributes.BedCount.Should().Be(newBedroom.BedCount); + bedroomData.Relationships.Should().BeNull(); + + response.AtomicResults.ElementAt(4).Data.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData5 = response.AtomicResults.ElementAt(5).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes5 = familyHomeData5.Attributes.Should().BeOfType().Subject; + familyHomeAttributes5.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeAttributes5.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes5.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData5.Relationships.Should().BeNull(); + + response.AtomicResults.ElementAt(6).Data.Should().BeNull(); + + long newMansionId = long.Parse(mansionData.Id.Should().NotBeNull().And.Subject); + long newKitchenId = long.Parse(kitchenData.Id.Should().NotBeNull().And.Subject); + long newFamilyHomeId = long.Parse(familyHomeData2.Id.Should().NotBeNull().And.Subject); + long newBedroomId = long.Parse(bedroomData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Mansion mansionInDatabase = + await dbContext.Mansions.Include(mansion => mansion.Rooms).Include(mansion => mansion.Staff).FirstWithIdAsync(newMansionId); + + mansionInDatabase.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionInDatabase.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionInDatabase.OwnerName.Should().Be(newMansion.OwnerName); + + mansionInDatabase.Rooms.Should().BeEmpty(); + mansionInDatabase.Staff.Should().HaveCount(1); + mansionInDatabase.Staff.ElementAt(0).Id.Should().Be(existingStaffMember.Id); + + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(2); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == newKitchenId); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == newBedroomId); + }); + } + + [Fact] + public async Task Cannot_use_base_attributes_type_in_derived_data() + { + // Arrange + int newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters!.Value; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new SubsetOfOperationsInheritanceClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new CreateResidenceOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Attributes = new AttributesInCreateResidenceRequest + { + OpenapiDiscriminator = ResourceType.Residences, + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + } + ] + }; + + // Act + Func action = async () => await apiClient.Operations.PostAsync(requestBody); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.Conflict); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("409"); + error.Title.Should().Be("Incompatible resource type found."); + error.Detail.Should().Be("Expected openapi:discriminator with value 'familyHomes' instead of 'residences'."); + error.Source.Should().NotBeNull(); + error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/openapi:discriminator"); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..07391862b9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,119 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings +{ + /// + /// Builds and executes requests for operations under \buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.buildings.item collection + /// The identifier of the building to update. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", rawUrl) + { + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Creates a new building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs new file mode 100644 index 0000000000..246d250d5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs @@ -0,0 +1,103 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item +{ + /// + /// Builds and executes requests for operations under \buildings\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", rawUrl) + { + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Updates an existing building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs new file mode 100644 index 0000000000..669dfa603d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths +{ + /// + /// Builds and executes requests for operations under \cyclePaths + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.cyclePaths.item collection + /// The identifier of the cyclePath to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs new file mode 100644 index 0000000000..c66722264f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item +{ + /// + /// Builds and executes requests for operations under \cyclePaths\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", rawUrl) + { + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Districts/DistrictsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Districts/DistrictsRequestBuilder.cs new file mode 100644 index 0000000000..02116844d5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Districts/DistrictsRequestBuilder.cs @@ -0,0 +1,126 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts +{ + /// + /// Builds and executes requests for operations under \districts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DistrictCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of districts. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs new file mode 100644 index 0000000000..162c733ba3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes +{ + /// + /// Builds and executes requests for operations under \familyHomes + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.familyHomes.item collection + /// The identifier of the familyHome whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs new file mode 100644 index 0000000000..d49a39c758 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..e8ffc0c1f4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..0d45a32849 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBathroomResponse.cs new file mode 100644 index 0000000000..f51562d350 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBathroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBedroomResponse.cs new file mode 100644 index 0000000000..6c44ab0a6a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBedroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBuildingResponse.cs new file mode 100644 index 0000000000..66b88075f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBuildingResponse.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs new file mode 100644 index 0000000000..f4ff046637 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..59f327fe48 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateMansionRequest.cs new file mode 100644 index 0000000000..df3c20bcb9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..9d7f3b41b8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs new file mode 100644 index 0000000000..e2a33c7932 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCyclePathResponse.cs new file mode 100644 index 0000000000..4a42106037 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCyclePathResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInDistrictResponse.cs new file mode 100644 index 0000000000..38e8c822d7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInDistrictResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs new file mode 100644 index 0000000000..71753666e9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInKitchenResponse.cs new file mode 100644 index 0000000000..9cf8215f88 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInKitchenResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInLivingRoomResponse.cs new file mode 100644 index 0000000000..a98472a4e1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInLivingRoomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInMansionResponse.cs new file mode 100644 index 0000000000..6a6480ecc6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResidenceResponse.cs new file mode 100644 index 0000000000..2f44b26537 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..f3c19d45ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoadResponse.cs new file mode 100644 index 0000000000..5076e5f002 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoadResponse.cs @@ -0,0 +1,64 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoomResponse.cs new file mode 100644 index 0000000000..618fec1da5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInStaffMemberResponse.cs new file mode 100644 index 0000000000..4105e56251 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInStaffMemberResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInToiletResponse.cs new file mode 100644 index 0000000000..2a4ac1e55e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInToiletResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..36a77baa7e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..14d8a06e14 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs new file mode 100644 index 0000000000..d7da56cfb5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..9136076afd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..7196132595 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..c8667f2d5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..91265e0f2e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..15ecf781e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..35b78a160d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..2f8239c39d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..2222502413 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CreateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CreateBuildingRequestDocument.cs new file mode 100644 index 0000000000..873b8e6ca2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CreateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CyclePathIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CyclePathIdentifierInResponse.cs new file mode 100644 index 0000000000..07cfbbc48e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CyclePathIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CyclePathIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CyclePathIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBathroomResponse.cs new file mode 100644 index 0000000000..0899b315b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBedroomResponse.cs new file mode 100644 index 0000000000..62b79767e7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBuildingResponse.cs new file mode 100644 index 0000000000..d14abd360a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBuildingResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateBuildingRequest.cs new file mode 100644 index 0000000000..30450c2557 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateBuildingRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..41e0cc12dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateMansionRequest.cs new file mode 100644 index 0000000000..2b17ea5c87 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateResidenceRequest.cs new file mode 100644 index 0000000000..736bbef4db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCyclePathResponse.cs new file mode 100644 index 0000000000..55c88a9abb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInDistrictResponse.cs new file mode 100644 index 0000000000..dd086726b5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInDistrictResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInFamilyHomeResponse.cs new file mode 100644 index 0000000000..07aeee39b0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInKitchenResponse.cs new file mode 100644 index 0000000000..9f8c881ce1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInLivingRoomResponse.cs new file mode 100644 index 0000000000..74738018a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInMansionResponse.cs new file mode 100644 index 0000000000..5943bcefeb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInMansionResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInResidenceResponse.cs new file mode 100644 index 0000000000..09ecacb0a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInResidenceResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoadResponse.cs new file mode 100644 index 0000000000..75a85a06c4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoadResponse.cs @@ -0,0 +1,91 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoomResponse.cs new file mode 100644 index 0000000000..f9bba2e9af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoomResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInStaffMemberResponse.cs new file mode 100644 index 0000000000..68850b163c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInStaffMemberResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInToiletResponse.cs new file mode 100644 index 0000000000..ac2e5be1b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..4ca06b894b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateBuildingRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..5d84c23f2b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateMansionRequest.cs new file mode 100644 index 0000000000..66dcfd88ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..4137f1e4b2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DistrictCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DistrictCollectionResponseDocument.cs new file mode 100644 index 0000000000..d97ffc5736 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DistrictCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DistrictCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DistrictCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..673ff6cc69 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..9303d07110 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..4376a86884 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..23f6c86d5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..d3e59f8189 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..351eb51dd1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..1d781d6591 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,90 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..2deed42b37 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..2b4bdcf012 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..b49157ed7f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..eed8947a34 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..83f7656f32 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..89d5f431a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs new file mode 100644 index 0000000000..38250f348d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBuildingResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBuildingResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs new file mode 100644 index 0000000000..b206ebc91c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryCyclePathResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryCyclePathResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryCyclePathResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryCyclePathResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..41478b1ec3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBathroomResponse.cs new file mode 100644 index 0000000000..fa353a6c65 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBedroomResponse.cs new file mode 100644 index 0000000000..77d81a7b64 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBuildingResponse.cs new file mode 100644 index 0000000000..c18d2bce59 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBuildingResponse.cs @@ -0,0 +1,57 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs new file mode 100644 index 0000000000..62c52b5ec4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..25fcd4de43 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs new file mode 100644 index 0000000000..5d7bfd7a9a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..419975712e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs new file mode 100644 index 0000000000..bbb02cba5e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs new file mode 100644 index 0000000000..bd4d9ef5de --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInDistrictResponse.cs new file mode 100644 index 0000000000..80c9044b3d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInDistrictResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs new file mode 100644 index 0000000000..dac880d49a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInKitchenResponse.cs new file mode 100644 index 0000000000..8e90ff1076 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs new file mode 100644 index 0000000000..e32e7c4626 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInMansionResponse.cs new file mode 100644 index 0000000000..f79ff1330e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResidenceResponse.cs new file mode 100644 index 0000000000..27fb9db71b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..0be66e31ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoadResponse.cs new file mode 100644 index 0000000000..af23055a11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoadResponse.cs @@ -0,0 +1,55 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoomResponse.cs new file mode 100644 index 0000000000..6a5d51c9c0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInToiletResponse.cs new file mode 100644 index 0000000000..b8b225006c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..655169e932 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..65e1aeb225 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs new file mode 100644 index 0000000000..70e3b955c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..5cd83e1238 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..b45ac2e7c7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..b7440b239b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..7dc32d06b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..85b409632a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..2c679847d0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..7706ae85b7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..6a079b9a5d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceLinks.cs similarity index 65% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceLinks.cs index f2e3f9b0de..820dd6691d 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceLinks.cs @@ -8,27 +8,27 @@ using System.Collections.Generic; using System.IO; using System; -namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class PlayerAttributesInResponse : IBackedModel, IParsable + public partial class ResourceLinks : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } - /// The userName property - public string? UserName + /// The self property + public string? Self { - get { return BackingStore?.Get("userName"); } - set { BackingStore?.Set("userName", value); } + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public PlayerAttributesInResponse() + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -36,12 +36,12 @@ public PlayerAttributesInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks(); } /// @@ -52,7 +52,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "userName", n => { UserName = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, }; } @@ -63,7 +63,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteStringValue("userName", UserName); + writer.WriteStringValue("self", Self); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..5619412cd0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..d5b1a5cc92 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "districts")] + #pragma warning disable CS1591 + Districts, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadIdentifierInResponse.cs new file mode 100644 index 0000000000..2be26c8741 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadIdentifierInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CyclePathIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadResourceType.cs new file mode 100644 index 0000000000..1c560a02a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoadResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..01a4ccf479 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..aaddb4e5bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..193c047e5d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..f576271515 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..be1f9d92ca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..da77c1b8f2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberResourceType.cs new file mode 100644 index 0000000000..204f6b3966 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StaffMemberResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyBuildingInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyBuildingInResponse.cs new file mode 100644 index 0000000000..0c8e337faa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyBuildingInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoadInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoadInResponse.cs new file mode 100644 index 0000000000..12eab9d58b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoadInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..5775926ba8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInResponse.cs new file mode 100644 index 0000000000..0036f10528 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..f931abee1e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInResponse.cs new file mode 100644 index 0000000000..86614046f1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToOneResidenceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToOneResidenceInResponse.cs new file mode 100644 index 0000000000..8a6886cbc2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToOneResidenceInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..9571533797 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..d2ce05f099 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/UpdateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/UpdateBuildingRequestDocument.cs new file mode 100644 index 0000000000..f22b72fce0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/UpdateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/SubsetOfVariousInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/SubsetOfVariousInheritanceClient.cs new file mode 100644 index 0000000000..d70ef584dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/SubsetOfVariousInheritanceClient.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SubsetOfVariousInheritanceClient : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The cyclePaths property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.CyclePathsRequestBuilder CyclePaths + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.CyclePathsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The districts property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder Districts + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The familyHomes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder FamilyHomes + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public SubsetOfVariousInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs new file mode 100644 index 0000000000..7e40d74c18 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs @@ -0,0 +1,151 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfVarious; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious; + +public sealed class IncludeTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public IncludeTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_include_in_primary_resources() + { + // Arrange + District district = _fakers.District.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(_fakers.LivingRoom.GenerateOne()); + familyHome.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(familyHome); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(_fakers.Kitchen.GenerateOne()); + mansion.Rooms.Add(_fakers.Bathroom.GenerateOne()); + mansion.Rooms.Add(_fakers.Toilet.GenerateOne()); + district.Buildings.Add(mansion); + + Residence residence = _fakers.Residence.GenerateOne(); + residence.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(residence); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Districts.Add(district); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new SubsetOfVariousInheritanceClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "buildings.rooms" + }); + + // Act + DistrictCollectionResponseDocument? response = await apiClient.Districts.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(district.StringId); + + response.Included.Should().HaveCount(9); + + string familyHomeLivingRoomId = familyHome.Rooms.OfType().Single().StringId!; + string familyRoomBedroomId = familyHome.Rooms.OfType().Single().StringId!; + string mansionKitchenId = mansion.Rooms.OfType().Single().StringId!; + string mansionBathroomId = mansion.Rooms.OfType().Single().StringId!; + string mansionToiletId = mansion.Rooms.OfType().Single().StringId!; + string residenceBedroomId = residence.Rooms.OfType().Single().StringId!; + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHome.StringId).Subject.With(include => + { + AttributesInFamilyHomeResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(2); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyHomeLivingRoomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyRoomBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == mansion.StringId).Subject.With(include => + { + AttributesInMansionResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(3); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionKitchenId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionBathroomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionToiletId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == residence.StringId).Subject.With(include => + { + AttributesInResidenceResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(1); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == residenceBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHomeLivingRoomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == familyRoomBedroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionKitchenId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionBathroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionToiletId); + response.Included.OfType().Should().ContainSingle(include => include.Id == residenceBedroomId); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs index 9fc6b6a4b9..fca3f36228 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -48,7 +48,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataInCreateWriteOnlyChannelRequest { - Type = WriteOnlyChannelResourceType.WriteOnlyChannels, + Type = ResourceType.WriteOnlyChannels, Attributes = new AttributesInCreateWriteOnlyChannelRequest { Name = newChannel.Name, @@ -60,7 +60,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingVideoStream.StringId! } }, @@ -70,7 +70,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingAudioStream.StringId! } ] @@ -87,7 +87,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - WriteOnlyChannelPrimaryResponseDocument? response = await apiClient.WriteOnlyChannels.PostAsync(requestBody); + PrimaryWriteOnlyChannelResponseDocument? response = await apiClient.WriteOnlyChannels.PostAsync(requestBody); // Assert response.Should().NotBeNull(); @@ -107,18 +107,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.Should().HaveCount(2); - response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId).Subject.With( - streamData => + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId).Subject.With( + include => { - streamData.Attributes.Should().NotBeNull(); - streamData.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); }); - response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingAudioStream.StringId).Subject.With( - streamData => + response.Included.OfType().Should().ContainSingle(include => include.Id == existingAudioStream.StringId).Subject.With( + include => { - streamData.Attributes.Should().NotBeNull(); - streamData.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); }); long newChannelId = long.Parse(response.Data.Id.Should().NotBeNull().And.Subject); @@ -179,7 +179,7 @@ public async Task Cannot_create_resource_with_unknown_relationship_ID() { Data = new DataInCreateWriteOnlyChannelRequest { - Type = WriteOnlyChannelResourceType.WriteOnlyChannels, + Type = ResourceType.WriteOnlyChannels, Attributes = new AttributesInCreateWriteOnlyChannelRequest { Name = newChannel.Name @@ -190,7 +190,7 @@ public async Task Cannot_create_resource_with_unknown_relationship_ID() { Data = new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = unknownVideoStreamId } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchResourceTests.cs index 5fff410d9c..05609f502e 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchResourceTests.cs @@ -50,7 +50,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.Data.Should().HaveCount(2); - ReadOnlyChannelDataInResponse channel1 = response.Data.Single(channel => channel.Id == channels.ElementAt(0).StringId); + DataInReadOnlyChannelResponse channel1 = response.Data.Single(channel => channel.Id == channels.ElementAt(0).StringId); channel1.Attributes.Should().NotBeNull(); channel1.Attributes.Name.Should().Be(channels[0].Name); channel1.Attributes.IsCommercial.Should().Be(channels[0].IsCommercial); @@ -63,7 +63,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => channel1.Relationships.AudioStreams.Should().NotBeNull(); channel1.Relationships.AudioStreams.Data.Should().BeNull(); - ReadOnlyChannelDataInResponse channel2 = response.Data.Single(channel => channel.Id == channels.ElementAt(1).StringId); + DataInReadOnlyChannelResponse channel2 = response.Data.Single(channel => channel.Id == channels.ElementAt(1).StringId); channel2.Attributes.Should().NotBeNull(); channel2.Attributes.Name.Should().Be(channels[1].Name); channel2.Attributes.IsCommercial.Should().Be(channels[1].IsCommercial); @@ -94,7 +94,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => var apiClient = new RestrictedControllersClient(requestAdapter); // Act - ReadOnlyChannelPrimaryResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].GetAsync(); + PrimaryReadOnlyChannelResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].GetAsync(); // Assert response.Should().NotBeNull(); @@ -154,7 +154,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => var apiClient = new RestrictedControllersClient(requestAdapter); // Act - DataStreamSecondaryResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].VideoStream.GetAsync(); + SecondaryDataStreamResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].VideoStream.GetAsync(); // Assert response.Should().NotBeNull(); @@ -181,7 +181,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => var apiClient = new RestrictedControllersClient(requestAdapter); // Act - NullableDataStreamSecondaryResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].UltraHighDefinitionVideoStream.GetAsync(); + NullableSecondaryDataStreamResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].UltraHighDefinitionVideoStream.GetAsync(); // Assert response.Should().NotBeNull(); @@ -212,11 +212,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.Data.Should().HaveCount(2); - DataStreamDataInResponse audioStream1 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); + DataInDataStreamResponse audioStream1 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); audioStream1.Attributes.Should().NotBeNull(); audioStream1.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(0).BytesTransmitted); - DataStreamDataInResponse audioStream2 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); + DataInDataStreamResponse audioStream2 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); audioStream2.Attributes.Should().NotBeNull(); audioStream2.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(1).BytesTransmitted); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/DataStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/DataStreamsRequestBuilder.cs index 94e77ccf91..ac1fb093a5 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/DataStreamsRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/DataStreamsRequestBuilder.cs @@ -88,7 +88,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual dataStream by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public DataStreamsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapt { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateWriteOnlyChannelRequest.cs index a7d44370c1..d500c4990b 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateWriteOnlyChannelRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInCreateWriteOnlyChannelRequest : IBackedModel, IParsable + public partial class AttributesInCreateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The isAdultOnly property public bool? IsAdultOnly { @@ -39,20 +35,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInCreateWriteOnlyChannelRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest(); @@ -62,9 +50,9 @@ public AttributesInCreateWriteOnlyChannelRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteBoolValue("isAdultOnly", IsAdultOnly); writer.WriteBoolValue("isCommercial", IsCommercial); writer.WriteStringValue("name", Name); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInDataStreamResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInDataStreamResponse.cs new file mode 100644 index 0000000000..4a9f5d811e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInDataStreamResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInDataStreamResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The bytesTransmitted property + public long? BytesTransmitted + { + get { return BackingStore?.Get("bytesTransmitted"); } + set { BackingStore?.Set("bytesTransmitted", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bytesTransmitted", n => { BytesTransmitted = n.GetLongValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteLongValue("bytesTransmitted", BytesTransmitted); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyChannelResponse.cs similarity index 68% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyChannelResponse.cs index 04d5298f24..bfee76bc49 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyChannelResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyChannelAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInReadOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The isAdultOnly property public bool? IsAdultOnly { @@ -39,32 +35,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public ReadOnlyChannelAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteBoolValue("isAdultOnly", IsAdultOnly); writer.WriteBoolValue("isCommercial", IsCommercial); writer.WriteStringValue("name", Name); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyResourceChannelResponse.cs similarity index 67% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyResourceChannelResponse.cs index f8f6623555..7693212745 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyResourceChannelResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyResourceChannelAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInReadOnlyResourceChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The isAdultOnly property public bool? IsAdultOnly { @@ -39,32 +35,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public ReadOnlyResourceChannelAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteBoolValue("isAdultOnly", IsAdultOnly); writer.WriteBoolValue("isCommercial", IsCommercial); writer.WriteStringValue("name", Name); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..a239b32c64 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "dataStreams" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse(), + "readOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse(), + "readOnlyResourceChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse(), + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..b03000812c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateWriteOnlyChannelRequest.cs index 513c0e4496..58b46afa4a 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateWriteOnlyChannelRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class AttributesInUpdateWriteOnlyChannelRequest : IBackedModel, IParsable + public partial class AttributesInUpdateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The isAdultOnly property public bool? IsAdultOnly { @@ -39,20 +35,12 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public AttributesInUpdateWriteOnlyChannelRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest(); @@ -62,9 +50,9 @@ public AttributesInUpdateWriteOnlyChannelRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteBoolValue("isAdultOnly", IsAdultOnly); writer.WriteBoolValue("isCommercial", IsCommercial); writer.WriteStringValue("name", Name); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInWriteOnlyChannelResponse.cs similarity index 68% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelAttributesInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInWriteOnlyChannelResponse.cs index 58149136e2..e9d0d2aa3f 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelAttributesInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInWriteOnlyChannelResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class WriteOnlyChannelAttributesInResponse : IBackedModel, IParsable + public partial class AttributesInWriteOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The isAdultOnly property public bool? IsAdultOnly { @@ -39,32 +35,24 @@ public string? Name set { BackingStore?.Set("name", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public WriteOnlyChannelAttributesInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelAttributesInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteBoolValue("isAdultOnly", IsAdultOnly); writer.WriteBoolValue("isCommercial", IsCommercial); writer.WriteStringValue("name", Name); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs index 69bd176690..77478b5490 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInCreateWriteOnlyChannelRequest : IBackedModel, IParsable + public partial class DataInCreateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInCreateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,16 +21,6 @@ public partial class DataInCreateWriteOnlyChannelRequest : IBackedModel, IParsab set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - - /// The meta property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest? Relationships { @@ -39,27 +28,12 @@ public partial class DataInCreateWriteOnlyChannelRequest : IBackedModel, IParsab set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInCreateWriteOnlyChannelRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest(); @@ -69,14 +43,12 @@ public DataInCreateWriteOnlyChannelRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "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(); } }, }; } @@ -84,13 +56,12 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/DataStreamDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInDataStreamResponse.cs similarity index 82% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInDataStreamResponse.cs index 3b0369009f..c139f58730 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInDataStreamResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataStreamDataInResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInDataStreamResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -38,12 +38,12 @@ public string? Id /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse(); } /// @@ -54,7 +54,7 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, }; @@ -68,7 +68,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyChannelResponse.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyChannelResponse.cs index 6a2b7f1ef5..f58e182a63 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyChannelResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyChannelDataInResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInReadOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyResourceChannelResponse.cs similarity index 76% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyResourceChannelResponse.cs index e0167d1a87..5ab70abf76 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyResourceChannelResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyResourceChannelDataInResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInReadOnlyResourceChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs index 210e91a19d..8972625339 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInUpdateWriteOnlyChannelRequest : IBackedModel, IParsable + public partial class DataInUpdateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The attributes property @@ -22,9 +21,6 @@ public partial class DataInUpdateWriteOnlyChannelRequest : IBackedModel, IParsab set { BackingStore?.Set("attributes", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -32,13 +28,6 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - /// The relationships property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest? Relationships { @@ -46,27 +35,12 @@ public string? Id set { BackingStore?.Set("relationships", value); } } - /// The type property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataInUpdateWriteOnlyChannelRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest(); @@ -76,15 +50,13 @@ public DataInUpdateWriteOnlyChannelRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.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(); } }, }; } @@ -92,14 +64,13 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(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/WriteOnlyChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInWriteOnlyChannelResponse.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInWriteOnlyChannelResponse.cs index b65a7007be..6ddd971254 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInWriteOnlyChannelResponse.cs @@ -11,13 +11,13 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class WriteOnlyChannelDataInResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse, IParsable + public partial class DataInWriteOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable #pragma warning restore CS1591 { /// The attributes property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelAttributesInResponse? Attributes + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse? Attributes { - get { return BackingStore?.Get("attributes"); } + get { return BackingStore?.Get("attributes"); } set { BackingStore?.Set("attributes", value); } } @@ -36,21 +36,21 @@ public string? Id } /// The relationships property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelRelationshipsInResponse? Relationships + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse? Relationships { - get { return BackingStore?.Get("relationships"); } + get { return BackingStore?.Get("relationships"); } set { BackingStore?.Set("relationships", value); } } /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelDataInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse(); } /// @@ -61,10 +61,10 @@ public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { - { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse.CreateFromDiscriminatorValue); } }, }; } @@ -76,10 +76,10 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); - writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("relationships", Relationships); + writer.WriteObjectValue("relationships", Relationships); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs index 9422466cd1..dd2010b42d 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class DataStreamCollectionResponseDocument : IBackedModel, IParsa public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); 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 9c8541b9f8..cd7a7ff59b 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,12 +11,9 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataStreamIdentifierInRequest : IBackedModel, IParsable + public partial class DataStreamIdentifierInRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.IdentifierInRequest, IParsable #pragma warning restore CS1591 { - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The id property public string? Id { @@ -25,34 +21,12 @@ public string? Id set { BackingStore?.Set("id", value); } } - /// The meta property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } - - /// The type property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamResourceType? Type - { - get { return BackingStore?.Get("type"); } - set { BackingStore?.Set("type", value); } - } - - /// - /// Instantiates a new and sets the default values. - /// - public DataStreamIdentifierInRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest(); @@ -62,13 +36,11 @@ public DataStreamIdentifierInRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "id", n => { Id = n.GetStringValue(); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -76,12 +48,11 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteStringValue("id", Id); - writer.WriteObjectValue("meta", Meta); - writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..bd10e84a5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "dataStreams" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableSecondaryDataStreamResponseDocument.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamSecondaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableSecondaryDataStreamResponseDocument.cs index e75af68368..e604e3f280 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableSecondaryDataStreamResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class NullableDataStreamSecondaryResponseDocument : IBackedModel, IParsable + public partial class NullableSecondaryDataStreamResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class NullableDataStreamSecondaryResponseDocument : IBackedModel, } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public NullableDataStreamSecondaryResponseDocument() + public NullableSecondaryDataStreamResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public NullableDataStreamSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamSecondaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryDataStreamResponseDocument.cs similarity index 79% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryDataStreamResponseDocument.cs index 04d4d96032..cd2eaa367c 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryDataStreamResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataStreamPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryDataStreamResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class DataStreamPrimaryResponseDocument : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataStreamPrimaryResponseDocument() + public PrimaryDataStreamResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public DataStreamPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryDataStreamResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryDataStreamResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyChannelResponseDocument.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyChannelResponseDocument.cs index d533669cfe..76ab55657b 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyChannelResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyChannelPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryReadOnlyChannelResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class ReadOnlyChannelPrimaryResponseDocument : IBackedModel, IPar } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public ReadOnlyChannelPrimaryResponseDocument() + public PrimaryReadOnlyChannelResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public ReadOnlyChannelPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyChannelResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyChannelResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyResourceChannelResponseDocument.cs similarity index 77% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyResourceChannelResponseDocument.cs index 2eb4572c86..2e069325f4 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyResourceChannelResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyResourceChannelPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryReadOnlyResourceChannelResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class ReadOnlyResourceChannelPrimaryResponseDocument : IBackedMod } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public ReadOnlyResourceChannelPrimaryResponseDocument() + public PrimaryReadOnlyResourceChannelResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public ReadOnlyResourceChannelPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyResourceChannelResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyResourceChannelResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryWriteOnlyChannelResponseDocument.cs similarity index 77% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelPrimaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryWriteOnlyChannelResponseDocument.cs index e41e0b5685..c28af81a2d 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryWriteOnlyChannelResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class WriteOnlyChannelPrimaryResponseDocument : IBackedModel, IParsable + public partial class PrimaryWriteOnlyChannelResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class WriteOnlyChannelPrimaryResponseDocument : IBackedModel, IPa } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public WriteOnlyChannelPrimaryResponseDocument() + public PrimaryWriteOnlyChannelResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public WriteOnlyChannelPrimaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelPrimaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs index b014e774a1..91820513d6 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class ReadOnlyChannelCollectionResponseDocument : IBackedModel, I public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs index 1fb949f5df..4f5b4d82c8 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs @@ -19,16 +19,16 @@ public partial class ReadOnlyResourceChannelCollectionResponseDocument : IBacked public IBackingStore BackingStore { get; private set; } /// The data property - public List? Data + public List? Data { - get { return BackingStore?.Get?>("data"); } + get { return BackingStore?.Get?>("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelDataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..8362d04cb3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateWriteOnlyChannelRequest.cs index c85b1dbd73..0ce350dfa1 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateWriteOnlyChannelRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInCreateWriteOnlyChannelRequest : IBackedModel, IParsable + public partial class RelationshipsInCreateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable #pragma warning restore CS1591 { /// The audioStreams property @@ -22,9 +21,6 @@ public partial class RelationshipsInCreateWriteOnlyChannelRequest : IBackedModel set { BackingStore?.Set("audioStreams", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ultraHighDefinitionVideoStream property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest? UltraHighDefinitionVideoStream { @@ -39,20 +35,12 @@ public partial class RelationshipsInCreateWriteOnlyChannelRequest : IBackedModel set { BackingStore?.Set("videoStream", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInCreateWriteOnlyChannelRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest(); @@ -62,9 +50,9 @@ public RelationshipsInCreateWriteOnlyChannelRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest.CreateFromDiscriminatorValue); } }, { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("audioStreams", AudioStreams); writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); writer.WriteObjectValue("videoStream", VideoStream); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyChannelResponse.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyChannelResponse.cs index 462a945701..5c79ba3972 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyChannelResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyChannelRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInReadOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { /// The audioStreams property @@ -22,9 +21,6 @@ public partial class ReadOnlyChannelRelationshipsInResponse : IBackedModel, IPar set { BackingStore?.Set("audioStreams", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ultraHighDefinitionVideoStream property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse? UltraHighDefinitionVideoStream { @@ -39,32 +35,24 @@ public partial class ReadOnlyChannelRelationshipsInResponse : IBackedModel, IPar set { BackingStore?.Set("videoStream", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public ReadOnlyChannelRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse.CreateFromDiscriminatorValue); } }, { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("audioStreams", AudioStreams); writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); writer.WriteObjectValue("videoStream", VideoStream); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyResourceChannelResponse.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyResourceChannelResponse.cs index ea239d0411..689da3eb21 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyResourceChannelResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class WriteOnlyChannelRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInReadOnlyResourceChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { /// The audioStreams property @@ -22,9 +21,6 @@ public partial class WriteOnlyChannelRelationshipsInResponse : IBackedModel, IPa set { BackingStore?.Set("audioStreams", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ultraHighDefinitionVideoStream property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse? UltraHighDefinitionVideoStream { @@ -39,32 +35,24 @@ public partial class WriteOnlyChannelRelationshipsInResponse : IBackedModel, IPa set { BackingStore?.Set("videoStream", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public WriteOnlyChannelRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse.CreateFromDiscriminatorValue); } }, { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("audioStreams", AudioStreams); writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); writer.WriteObjectValue("videoStream", VideoStream); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..787b6582c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "readOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse(), + "readOnlyResourceChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse(), + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..455267e937 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateWriteOnlyChannelRequest.cs index 64d1482b41..cf520fbe85 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateWriteOnlyChannelRequest.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class RelationshipsInUpdateWriteOnlyChannelRequest : IBackedModel, IParsable + public partial class RelationshipsInUpdateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable #pragma warning restore CS1591 { /// The audioStreams property @@ -22,9 +21,6 @@ public partial class RelationshipsInUpdateWriteOnlyChannelRequest : IBackedModel set { BackingStore?.Set("audioStreams", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ultraHighDefinitionVideoStream property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest? UltraHighDefinitionVideoStream { @@ -39,20 +35,12 @@ public partial class RelationshipsInUpdateWriteOnlyChannelRequest : IBackedModel set { BackingStore?.Set("videoStream", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public RelationshipsInUpdateWriteOnlyChannelRequest() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest(); @@ -62,9 +50,9 @@ public RelationshipsInUpdateWriteOnlyChannelRequest() /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest.CreateFromDiscriminatorValue); } }, { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("audioStreams", AudioStreams); writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); writer.WriteObjectValue("videoStream", VideoStream); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInWriteOnlyChannelResponse.cs similarity index 77% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelRelationshipsInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInWriteOnlyChannelResponse.cs index e333c8d37f..f46ec749de 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelRelationshipsInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInWriteOnlyChannelResponse.cs @@ -4,7 +4,6 @@ #pragma warning disable CS0618 using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; -using Microsoft.Kiota.Abstractions.Store; using System.Collections.Generic; using System.IO; using System; @@ -12,7 +11,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class ReadOnlyResourceChannelRelationshipsInResponse : IBackedModel, IParsable + public partial class RelationshipsInWriteOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse, IParsable #pragma warning restore CS1591 { /// The audioStreams property @@ -22,9 +21,6 @@ public partial class ReadOnlyResourceChannelRelationshipsInResponse : IBackedMod set { BackingStore?.Set("audioStreams", value); } } - /// Stores model information. - public IBackingStore BackingStore { get; private set; } - /// The ultraHighDefinitionVideoStream property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse? UltraHighDefinitionVideoStream { @@ -39,32 +35,24 @@ public partial class ReadOnlyResourceChannelRelationshipsInResponse : IBackedMod set { BackingStore?.Set("videoStream", value); } } - /// - /// Instantiates a new and sets the default values. - /// - public ReadOnlyResourceChannelRelationshipsInResponse() - { - BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); - } - /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelRelationshipsInResponse(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse(); } /// /// The deserialization information for the current model /// /// A IDictionary<string, Action<IParseNode>> - public virtual IDictionary> GetFieldDeserializers() + public override IDictionary> GetFieldDeserializers() { - return new Dictionary> + return new Dictionary>(base.GetFieldDeserializers()) { { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse.CreateFromDiscriminatorValue); } }, { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, @@ -76,9 +64,10 @@ public virtual IDictionary> GetFieldDeserializers() /// Serializes information the current object /// /// Serialization writer to use to serialize this model - public virtual void Serialize(ISerializationWriter writer) + public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); writer.WriteObjectValue("audioStreams", AudioStreams); writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); writer.WriteObjectValue("videoStream", VideoStream); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..dae9e59575 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInResponse.cs similarity index 83% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInResponse.cs index cac3cf338f..ce97d6a1c8 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInResponse.cs @@ -12,7 +12,7 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataInResponse : IBackedModel, IParsable + public partial class ResourceInResponse : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. @@ -33,9 +33,9 @@ public partial class DataInResponse : IBackedModel, IParsable } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataInResponse() + public ResourceInResponse() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -43,19 +43,19 @@ public DataInResponse() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); return mappingValue switch { - "dataStreams" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse(), - "readOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelDataInResponse(), - "readOnlyResourceChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelDataInResponse(), - "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelDataInResponse(), - _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse(), + "dataStreams" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse(), + "readOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse(), + "readOnlyResourceChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse(), + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse(), }; } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..395a5e9419 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/SecondaryDataStreamResponseDocument.cs similarity index 78% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamSecondaryResponseDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/SecondaryDataStreamResponseDocument.cs index 136f45664c..6314c4e2e2 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/SecondaryDataStreamResponseDocument.cs @@ -12,23 +12,23 @@ namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] #pragma warning disable CS1591 - public partial class DataStreamSecondaryResponseDocument : IBackedModel, IParsable + public partial class SecondaryDataStreamResponseDocument : IBackedModel, IParsable #pragma warning restore CS1591 { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The data property - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse? Data + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse? Data { - get { return BackingStore?.Get("data"); } + get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } /// The included property - public List? Included + public List? Included { - get { return BackingStore?.Get?>("included"); } + get { return BackingStore?.Get?>("included"); } set { BackingStore?.Set("included", value); } } @@ -47,9 +47,9 @@ public partial class DataStreamSecondaryResponseDocument : IBackedModel, IParsab } /// - /// Instantiates a new and sets the default values. + /// Instantiates a new and sets the default values. /// - public DataStreamSecondaryResponseDocument() + public SecondaryDataStreamResponseDocument() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } @@ -57,12 +57,12 @@ public DataStreamSecondaryResponseDocument() /// /// Creates a new instance of the appropriate class based on discriminator value /// - /// A + /// A /// The parse node to use to read the discriminator value and create the object - public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamSecondaryResponseDocument(); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument(); } /// @@ -73,8 +73,8 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { - { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamDataInResponse.CreateFromDiscriminatorValue); } }, - { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; @@ -87,8 +87,8 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); - writer.WriteObjectValue("data", Data); - writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs index 213b727f0f..2d07d91395 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual readOnlyChannel by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -81,7 +81,7 @@ public ReadOnlyChannelsItemRequestBuilder(string rawUrl, IRequestAdapter request { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -104,7 +104,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related dataStream of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public UltraHighDefinitionVideoStreamRequestBuilder(string rawUrl, IRequestAdapt { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related dataStream of an individual readOnlyChannel's videoStream relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public VideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves an individual readOnlyResourceChannel by its identifier. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -74,7 +74,7 @@ public ReadOnlyResourceChannelsItemRequestBuilder(string rawUrl, IRequestAdapter { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyResourceChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -97,7 +97,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related dataStream of an individual readOnlyResourceChannel's ultraHighDefinitionVideoStream relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public UltraHighDefinitionVideoStreamRequestBuilder(string rawUrl, IRequestAdapt { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Retrieves the related dataStream of an individual readOnlyResourceChannel's videoStream relationship. /// - /// A + /// A /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. /// When receiving a 400 status code /// When receiving a 404 status code - public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { var requestInfo = ToGetRequestInformation(requestConfiguration); var errorMapping = new Dictionary> @@ -53,7 +53,7 @@ public VideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -76,7 +76,7 @@ public RequestInformation ToGetRequestInformation(Action /// Updates an existing writeOnlyChannel. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -71,7 +71,7 @@ public async Task DeleteAsync(ActionWhen receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.UpdateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.UpdateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPatchRequestInformation(body, requestConfiguration); @@ -82,7 +82,7 @@ public async Task DeleteAsync(Action(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -94,7 +94,7 @@ public RequestInformation ToDeleteRequestInformation(Action /// Creates a new writeOnlyChannel. /// - /// A + /// A /// The request body /// Cancellation token to use when cancelling requests /// Configuration for the request such as headers, query parameters, and middleware options. @@ -63,7 +63,7 @@ public WriteOnlyChannelsRequestBuilder(string rawUrl, IRequestAdapter requestAda /// When receiving a 404 status code /// When receiving a 409 status code /// When receiving a 422 status code - public async Task PostAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.CreateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.CreateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = ToPostRequestInformation(body, requestConfiguration); @@ -75,7 +75,7 @@ public WriteOnlyChannelsRequestBuilder(string rawUrl, IRequestAdapter requestAda { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, }; - return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); } /// @@ -89,8 +89,8 @@ public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndT _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); requestInfo.Configure(requestConfiguration); - requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); - requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); return requestInfo; } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs index 87fcbbfbdb..7be939449b 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs @@ -51,7 +51,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingVideoStream.StringId! } }; @@ -143,7 +143,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingAudioStream.StringId! } ] @@ -236,7 +236,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingAudioStream.StringId! } ] @@ -286,12 +286,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingChannel.AudioStreams.ElementAt(0).StringId! }, new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingChannel.AudioStreams.ElementAt(1).StringId! } ] @@ -368,12 +368,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = unknownAudioStreamId1 }, new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = unknownAudioStreamId2 } ] diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs index 98846012cb..9c20a8db4e 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs @@ -57,7 +57,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataInUpdateWriteOnlyChannelRequest { - Type = WriteOnlyChannelResourceType.WriteOnlyChannels, + Type = ResourceType.WriteOnlyChannels, Id = existingChannel.StringId!, Attributes = new AttributesInUpdateWriteOnlyChannelRequest { @@ -69,7 +69,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = existingVideoStream.StringId! } }, @@ -93,7 +93,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - WriteOnlyChannelPrimaryResponseDocument? response = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); + PrimaryWriteOnlyChannelResponseDocument? response = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); // Assert response.Should().NotBeNull(); @@ -112,7 +112,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Relationships.AudioStreams.Data.Should().BeEmpty(); response.Included.Should().HaveCount(1); - response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -163,7 +163,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataInUpdateWriteOnlyChannelRequest { - Type = WriteOnlyChannelResourceType.WriteOnlyChannels, + Type = ResourceType.WriteOnlyChannels, Id = existingChannel.StringId!, Attributes = new AttributesInUpdateWriteOnlyChannelRequest(), Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest() @@ -171,7 +171,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - WriteOnlyChannelPrimaryResponseDocument? response = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); + PrimaryWriteOnlyChannelResponseDocument? response = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); // Assert response.Should().NotBeNull(); @@ -264,7 +264,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataInUpdateWriteOnlyChannelRequest { - Type = WriteOnlyChannelResourceType.WriteOnlyChannels, + Type = ResourceType.WriteOnlyChannels, Id = existingChannel.StringId!, Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest { @@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => { Data = new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = unknownDataStreamId } }, @@ -282,7 +282,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => [ new DataStreamIdentifierInRequest { - Type = DataStreamResourceType.DataStreams, + Type = ResourceType.DataStreams, Id = unknownDataStreamId } ] diff --git a/test/OpenApiNSwagClientTests/ChangeTracking/SerializerChangeTrackingTests.cs b/test/OpenApiNSwagClientTests/ChangeTracking/SerializerChangeTrackingTests.cs index 8e44638ad3..d14d2ae4c6 100644 --- a/test/OpenApiNSwagClientTests/ChangeTracking/SerializerChangeTrackingTests.cs +++ b/test/OpenApiNSwagClientTests/ChangeTracking/SerializerChangeTrackingTests.cs @@ -50,6 +50,7 @@ public async Task Includes_properties_with_default_values_when_tracked() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "requiredNonNullableReferenceType": "other", "nullableReferenceType": null, "valueType": 0, @@ -90,6 +91,7 @@ public async Task Excludes_properties_with_default_values_when_not_tracked() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "requiredNonNullableReferenceType": "other" } } @@ -137,6 +139,7 @@ public async Task Properties_can_be_changed_to_default_values_once_tracked() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "nullableReferenceType": null, "valueType": 0, "nullableValueType": null @@ -189,6 +192,7 @@ public async Task Automatically_clears_tracked_properties_after_sending_request( "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "valueType": 1, "requiredValueType": 2, "requiredNullableValueType": 3 @@ -241,6 +245,7 @@ public async Task Can_preserve_tracked_properties_after_sending_request() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "nullableReferenceType": null, "valueType": 0, "nullableValueType": null @@ -296,6 +301,7 @@ public async Task Can_manually_clear_tracked_properties() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "valueType": 1, "requiredValueType": 2, "requiredNullableValueType": 3 @@ -336,6 +342,7 @@ public async Task Can_mark_existing_instance_as_tracked() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "requiredNonNullableReferenceType": "other" } } @@ -380,6 +387,7 @@ public async Task Can_mark_properties_on_existing_instance_as_tracked() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "nullableReferenceType": null, "valueType": 0, "nullableValueType": null @@ -479,6 +487,7 @@ public async Task Tracking_a_different_instance_of_same_type_upfront_is_isolated "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "nullableReferenceType": null, "nullableValueType": null } @@ -537,6 +546,7 @@ public async Task Tracking_a_different_instance_of_same_type_afterward_is_isolat "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "nullableReferenceType": null, "nullableValueType": null } @@ -598,6 +608,7 @@ public async Task Can_reuse_api_client() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "nullableReferenceType": null, "nullableValueType": null } @@ -656,6 +667,7 @@ public async Task Can_reuse_request_document_on_same_api_client() "type": "resources", "id": "{{resourceId}}", "attributes": { + "openapi:discriminator": "resources", "requiredNonNullableReferenceType": "other", "nullableReferenceType": null, "nullableValueType": null @@ -744,6 +756,7 @@ public async Task Can_track_multiple_times_in_same_request_document() "data": { "type": "staffMembers", "attributes": { + "openapi:discriminator": "staffMembers", "age": null } } @@ -754,6 +767,7 @@ public async Task Can_track_multiple_times_in_same_request_document() "data": { "type": "staffMembers", "attributes": { + "openapi:discriminator": "staffMembers", "name": "new-name" } } @@ -764,6 +778,7 @@ public async Task Can_track_multiple_times_in_same_request_document() "data": { "type": "supermarkets", "attributes": { + "openapi:discriminator": "supermarkets", "nameOfCity": "new-name-of-city" } } @@ -774,6 +789,7 @@ public async Task Can_track_multiple_times_in_same_request_document() "data": { "type": "supermarkets", "attributes": { + "openapi:discriminator": "supermarkets", "kind": null } } diff --git a/test/OpenApiNSwagClientTests/LegacyOpenApi/RequestTests.cs b/test/OpenApiNSwagClientTests/LegacyOpenApi/RequestTests.cs index a0f58c27c7..4d153ca80d 100644 --- a/test/OpenApiNSwagClientTests/LegacyOpenApi/RequestTests.cs +++ b/test/OpenApiNSwagClientTests/LegacyOpenApi/RequestTests.cs @@ -2,7 +2,6 @@ using FluentAssertions; using FluentAssertions.Common; using FluentAssertions.Extensions; -using JsonApiDotNetCore.Middleware; using JsonApiDotNetCore.OpenApi.Client.NSwag; using Microsoft.Net.Http.Headers; using OpenApiNSwagClientTests.LegacyOpenApi.GeneratedCode; @@ -13,6 +12,7 @@ namespace OpenApiNSwagClientTests.LegacyOpenApi; public sealed class RequestTests { + private const string OpenApiMediaType = "application/vnd.api+json; ext=openapi"; private const string HostPrefix = "http://localhost/api/"; [Fact] @@ -27,7 +27,7 @@ public async Task Getting_resource_collection_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Get); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights"); wrapper.RequestBody.Should().BeNull(); @@ -47,7 +47,7 @@ public async Task Getting_resource_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Get); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}"); wrapper.RequestBody.Should().BeNull(); @@ -89,18 +89,19 @@ public async Task Partial_posting_resource_with_selected_relationships_produces_ // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Post); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights"); wrapper.Request.Content.Should().NotBeNull(); wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); - wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); wrapper.RequestBody.Should().BeJson(""" { "data": { "type": "flights", "relationships": { + "openapi:discriminator": "flights", "purser": { "data": { "type": "flight-attendants", @@ -160,18 +161,19 @@ public async Task Partial_posting_resource_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Post); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}airplanes"); wrapper.Request.Content.Should().NotBeNull(); wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); - wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); wrapper.RequestBody.Should().BeJson($$""" { "data": { "type": "airplanes", "attributes": { + "openapi:discriminator": "airplanes", "name": "{{name}}", "serial-number": null, "airtime-in-hours": 800 @@ -214,12 +216,12 @@ public async Task Partial_patching_resource_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Patch); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}airplanes/{airplaneId}"); wrapper.Request.Content.Should().NotBeNull(); wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); - wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); wrapper.RequestBody.Should().BeJson(""" { @@ -227,6 +229,7 @@ public async Task Partial_patching_resource_produces_expected_request() "type": "airplanes", "id": "XUuiP", "attributes": { + "openapi:discriminator": "airplanes", "serial-number": null, "airtime-in-hours": null, "last-serviced-at": "2021-01-01T15:23:05.033+04:00", @@ -270,7 +273,7 @@ public async Task Getting_secondary_resource_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Get); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/purser"); wrapper.RequestBody.Should().BeNull(); @@ -290,7 +293,7 @@ public async Task Getting_secondary_resources_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Get); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/cabin-crew-members"); wrapper.RequestBody.Should().BeNull(); @@ -310,7 +313,7 @@ public async Task Getting_ToOne_relationship_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Get); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/purser"); wrapper.RequestBody.Should().BeNull(); @@ -342,7 +345,7 @@ public async Task Patching_ToOne_relationship_produces_expected_request() wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/purser"); wrapper.Request.Content.Should().NotBeNull(); wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); - wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); wrapper.RequestBody.Should().BeJson(""" { @@ -368,7 +371,7 @@ public async Task Getting_ToMany_relationship_produces_expected_request() // Assert wrapper.Request.Should().NotBeNull(); - wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); wrapper.Request.Method.Should().Be(HttpMethod.Get); wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); wrapper.RequestBody.Should().BeNull(); @@ -407,7 +410,7 @@ public async Task Posting_ToMany_relationship_produces_expected_request() wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); wrapper.Request.Content.Should().NotBeNull(); wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); - wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); wrapper.RequestBody.Should().BeJson(""" { @@ -458,7 +461,7 @@ public async Task Patching_ToMany_relationship_produces_expected_request() wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); wrapper.Request.Content.Should().NotBeNull(); wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); - wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); wrapper.RequestBody.Should().BeJson(""" { @@ -509,7 +512,7 @@ public async Task Deleting_ToMany_relationship_produces_expected_request() wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); wrapper.Request.Content.Should().NotBeNull(); wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); - wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(JsonApiMediaType.Default.ToString()); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); wrapper.RequestBody.Should().BeJson(""" { diff --git a/test/OpenApiNSwagClientTests/LegacyOpenApi/ResponseTests.cs b/test/OpenApiNSwagClientTests/LegacyOpenApi/ResponseTests.cs index 5612dc9f68..0da98c30af 100644 --- a/test/OpenApiNSwagClientTests/LegacyOpenApi/ResponseTests.cs +++ b/test/OpenApiNSwagClientTests/LegacyOpenApi/ResponseTests.cs @@ -108,7 +108,7 @@ public async Task Getting_resource_collection_translates_response() response.Links.Last.Should().Be(topLevelLink); response.Data.Should().HaveCount(1); - FlightDataInResponse flight = response.Data.First(); + DataInFlightResponse flight = response.Data.First(); flight.Id.Should().Be(flightId); flight.Links.Self.Should().Be(flightResourceLink); flight.Meta.Should().HaveCount(1); @@ -178,7 +178,7 @@ public async Task Getting_resource_translates_response() var apiClient = new LegacyClient(wrapper.HttpClient); // Act - FlightPrimaryResponseDocument response = await apiClient.GetFlightAsync(flightId, null, null); + PrimaryFlightResponseDocument response = await apiClient.GetFlightAsync(flightId, null, null); // Assert response.Jsonapi.Should().BeNull(); @@ -230,7 +230,7 @@ public async Task Getting_unknown_resource_translates_error_response() exception.Result.Links.Describedby.Should().Be("/swagger/v1/swagger.json"); exception.Result.Errors.Should().HaveCount(1); - ErrorObject? error = exception.Result.Errors.ElementAt(0); + ErrorObject error = exception.Result.Errors.ElementAt(0); error.Id.Should().Be("f1a520ac-02a0-466b-94ea-86cbaa86f02f"); error.Status.Should().Be("404"); error.Title.Should().Be("The requested resource does not exist."); @@ -312,7 +312,7 @@ public async Task Posting_resource_translates_response() }; // Act - FlightPrimaryResponseDocument response = await apiClient.PostFlightAsync(null, requestBody); + PrimaryFlightResponseDocument response = await apiClient.PostFlightAsync(null, requestBody); // Assert response.Data.Attributes.Should().BeNull(); @@ -357,7 +357,7 @@ public async Task Patching_resource_with_side_effects_translates_response() }; // Act - FlightPrimaryResponseDocument response = await apiClient.PatchFlightAsync(flightId, null, requestBody); + PrimaryFlightResponseDocument response = await apiClient.PatchFlightAsync(flightId, null, requestBody); // Assert response.Data.Attributes.Should().BeNull(); @@ -373,7 +373,7 @@ public async Task Patching_resource_without_side_effects_translates_response() var apiClient = new LegacyClient(wrapper.HttpClient); // Act - FlightPrimaryResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PatchFlightAsync(flightId, null, + PrimaryFlightResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PatchFlightAsync(flightId, null, new UpdateFlightRequestDocument { Data = new DataInUpdateFlightRequest @@ -452,7 +452,7 @@ public async Task Getting_secondary_resource_translates_response() var apiClient = new LegacyClient(wrapper.HttpClient); // Act - FlightAttendantSecondaryResponseDocument response = await apiClient.GetFlightPurserAsync(flightId, null, null); + SecondaryFlightAttendantResponseDocument response = await apiClient.GetFlightPurserAsync(flightId, null, null); // Assert response.Data.Should().NotBeNull(); @@ -484,7 +484,7 @@ public async Task Getting_nullable_secondary_resource_translates_response() var apiClient = new LegacyClient(wrapper.HttpClient); // Act - NullableFlightAttendantSecondaryResponseDocument response = await apiClient.GetFlightBackupPurserAsync(flightId, null, null); + NullableSecondaryFlightAttendantResponseDocument response = await apiClient.GetFlightBackupPurserAsync(flightId, null, null); // Assert response.Data.Should().BeNull(); diff --git a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs index e4eb1c5887..6828e96d32 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs @@ -50,17 +50,17 @@ public void Generated_top_level_document_types_are_named_as_expected() { _ = nameof(SupermarketCollectionResponseDocument.Meta); _ = nameof(CreateSupermarketRequestDocument.Meta); - _ = nameof(SupermarketPrimaryResponseDocument.Meta); + _ = nameof(PrimarySupermarketResponseDocument.Meta); _ = nameof(UpdateSupermarketRequestDocument.Meta); _ = nameof(StaffMemberCollectionResponseDocument.Meta); _ = nameof(CreateStaffMemberRequestDocument.Meta); - _ = nameof(StaffMemberPrimaryResponseDocument.Meta); + _ = nameof(PrimaryStaffMemberResponseDocument.Meta); _ = nameof(UpdateStaffMemberRequestDocument.Meta); _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); _ = nameof(StaffMemberIdentifierResponseDocument.Meta); - _ = nameof(StaffMemberSecondaryResponseDocument.Meta); - _ = nameof(NullableStaffMemberSecondaryResponseDocument.Meta); + _ = nameof(SecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableSecondaryStaffMemberResponseDocument.Meta); _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); _ = nameof(ErrorResponseDocument.Meta); @@ -106,25 +106,25 @@ public void Generated_resource_field_types_are_named_as_expected() _ = nameof(AttributesInCreateSupermarketRequest.Kind); _ = nameof(AttributesInUpdateSupermarketRequest.NameOfCity); _ = nameof(AttributesInUpdateSupermarketRequest.Kind); - _ = nameof(SupermarketAttributesInResponse.NameOfCity); - _ = nameof(SupermarketAttributesInResponse.Kind); + _ = nameof(AttributesInSupermarketResponse.NameOfCity); + _ = nameof(AttributesInSupermarketResponse.Kind); _ = nameof(RelationshipsInCreateSupermarketRequest.StoreManager); _ = nameof(RelationshipsInCreateSupermarketRequest.BackupStoreManager); _ = nameof(RelationshipsInCreateSupermarketRequest.Cashiers); _ = nameof(RelationshipsInUpdateSupermarketRequest.StoreManager); _ = nameof(RelationshipsInUpdateSupermarketRequest.BackupStoreManager); _ = nameof(RelationshipsInUpdateSupermarketRequest.Cashiers); - _ = nameof(SupermarketRelationshipsInResponse.StoreManager); - _ = nameof(SupermarketRelationshipsInResponse.BackupStoreManager); - _ = nameof(SupermarketRelationshipsInResponse.Cashiers); + _ = nameof(RelationshipsInSupermarketResponse.StoreManager); + _ = nameof(RelationshipsInSupermarketResponse.BackupStoreManager); + _ = nameof(RelationshipsInSupermarketResponse.Cashiers); _ = nameof(SupermarketType); _ = nameof(AttributesInCreateStaffMemberRequest.Name); _ = nameof(AttributesInCreateStaffMemberRequest.Age); _ = nameof(AttributesInUpdateStaffMemberRequest.Name); _ = nameof(AttributesInUpdateStaffMemberRequest.Age); - _ = nameof(StaffMemberAttributesInResponse.Name); - _ = nameof(StaffMemberAttributesInResponse.Age); + _ = nameof(AttributesInStaffMemberResponse.Name); + _ = nameof(AttributesInStaffMemberResponse.Age); } [Fact] @@ -170,17 +170,20 @@ public void Generated_operation_type_enums_are_named_as_expected() [Fact] public void Generated_data_types_are_named_as_expected() { - _ = nameof(DataInResponse.Meta); + _ = nameof(ResourceInCreateRequest.Meta); + _ = nameof(ResourceInUpdateRequest.Meta); + _ = nameof(IdentifierInRequest.Meta); + _ = nameof(ResourceInResponse.Meta); _ = nameof(DataInCreateSupermarketRequest.Meta); _ = nameof(DataInUpdateSupermarketRequest.Meta); - _ = nameof(SupermarketDataInResponse.Meta); + _ = nameof(DataInSupermarketResponse.Meta); _ = nameof(SupermarketIdentifierInRequest.Meta); _ = nameof(DataInCreateStaffMemberRequest.Meta); _ = nameof(DataInUpdateStaffMemberRequest.Meta); - _ = nameof(StaffMemberDataInResponse.Meta); + _ = nameof(DataInStaffMemberResponse.Meta); _ = nameof(StaffMemberIdentifierInRequest.Meta); _ = nameof(StaffMemberIdentifierInResponse.Meta); diff --git a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs index 1bc37be106..ad58e822bd 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs @@ -50,17 +50,17 @@ public void Generated_top_level_document_types_are_named_as_expected() { _ = nameof(SupermarketCollectionResponseDocument.Meta); _ = nameof(CreateSupermarketRequestDocument.Meta); - _ = nameof(SupermarketPrimaryResponseDocument.Meta); + _ = nameof(PrimarySupermarketResponseDocument.Meta); _ = nameof(UpdateSupermarketRequestDocument.Meta); _ = nameof(StaffMemberCollectionResponseDocument.Meta); _ = nameof(CreateStaffMemberRequestDocument.Meta); - _ = nameof(StaffMemberPrimaryResponseDocument.Meta); + _ = nameof(PrimaryStaffMemberResponseDocument.Meta); _ = nameof(UpdateStaffMemberRequestDocument.Meta); _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); _ = nameof(StaffMemberIdentifierResponseDocument.Meta); - _ = nameof(StaffMemberSecondaryResponseDocument.Meta); - _ = nameof(NullableStaffMemberSecondaryResponseDocument.Meta); + _ = nameof(SecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableSecondaryStaffMemberResponseDocument.Meta); _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); _ = nameof(ErrorResponseDocument.Meta); @@ -106,25 +106,25 @@ public void Generated_resource_field_types_are_named_as_expected() _ = nameof(AttributesInCreateSupermarketRequest.Kind); _ = nameof(AttributesInUpdateSupermarketRequest.NameOfCity); _ = nameof(AttributesInUpdateSupermarketRequest.Kind); - _ = nameof(SupermarketAttributesInResponse.NameOfCity); - _ = nameof(SupermarketAttributesInResponse.Kind); + _ = nameof(AttributesInSupermarketResponse.NameOfCity); + _ = nameof(AttributesInSupermarketResponse.Kind); _ = nameof(RelationshipsInCreateSupermarketRequest.StoreManager); _ = nameof(RelationshipsInCreateSupermarketRequest.BackupStoreManager); _ = nameof(RelationshipsInCreateSupermarketRequest.Cashiers); _ = nameof(RelationshipsInUpdateSupermarketRequest.StoreManager); _ = nameof(RelationshipsInUpdateSupermarketRequest.BackupStoreManager); _ = nameof(RelationshipsInUpdateSupermarketRequest.Cashiers); - _ = nameof(SupermarketRelationshipsInResponse.StoreManager); - _ = nameof(SupermarketRelationshipsInResponse.BackupStoreManager); - _ = nameof(SupermarketRelationshipsInResponse.Cashiers); + _ = nameof(RelationshipsInSupermarketResponse.StoreManager); + _ = nameof(RelationshipsInSupermarketResponse.BackupStoreManager); + _ = nameof(RelationshipsInSupermarketResponse.Cashiers); _ = nameof(SupermarketType); _ = nameof(AttributesInCreateStaffMemberRequest.Name); _ = nameof(AttributesInCreateStaffMemberRequest.Age); _ = nameof(AttributesInUpdateStaffMemberRequest.Name); _ = nameof(AttributesInUpdateStaffMemberRequest.Age); - _ = nameof(StaffMemberAttributesInResponse.Name); - _ = nameof(StaffMemberAttributesInResponse.Age); + _ = nameof(AttributesInStaffMemberResponse.Name); + _ = nameof(AttributesInStaffMemberResponse.Age); } [Fact] @@ -170,17 +170,20 @@ public void Generated_operation_type_enums_are_named_as_expected() [Fact] public void Generated_data_types_are_named_as_expected() { - _ = nameof(DataInResponse.Meta); + _ = nameof(ResourceInCreateRequest.Meta); + _ = nameof(ResourceInUpdateRequest.Meta); + _ = nameof(IdentifierInRequest.Meta); + _ = nameof(ResourceInResponse.Meta); _ = nameof(DataInCreateSupermarketRequest.Meta); _ = nameof(DataInUpdateSupermarketRequest.Meta); - _ = nameof(SupermarketDataInResponse.Meta); + _ = nameof(DataInSupermarketResponse.Meta); _ = nameof(SupermarketIdentifierInRequest.Meta); _ = nameof(DataInCreateStaffMemberRequest.Meta); _ = nameof(DataInUpdateStaffMemberRequest.Meta); - _ = nameof(StaffMemberDataInResponse.Meta); + _ = nameof(DataInStaffMemberResponse.Meta); _ = nameof(StaffMemberIdentifierInRequest.Meta); _ = nameof(StaffMemberIdentifierInResponse.Meta); diff --git a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs index af51fad478..916cd8d053 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs @@ -50,17 +50,17 @@ public void Generated_top_level_document_types_are_named_as_expected() { _ = nameof(SupermarketCollectionResponseDocument.Meta); _ = nameof(CreateSupermarketRequestDocument.Meta); - _ = nameof(SupermarketPrimaryResponseDocument.Meta); + _ = nameof(PrimarySupermarketResponseDocument.Meta); _ = nameof(UpdateSupermarketRequestDocument.Meta); _ = nameof(StaffMemberCollectionResponseDocument.Meta); _ = nameof(CreateStaffMemberRequestDocument.Meta); - _ = nameof(StaffMemberPrimaryResponseDocument.Meta); + _ = nameof(PrimaryStaffMemberResponseDocument.Meta); _ = nameof(UpdateStaffMemberRequestDocument.Meta); _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); _ = nameof(StaffMemberIdentifierResponseDocument.Meta); - _ = nameof(StaffMemberSecondaryResponseDocument.Meta); - _ = nameof(NullableStaffMemberSecondaryResponseDocument.Meta); + _ = nameof(SecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableSecondaryStaffMemberResponseDocument.Meta); _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); _ = nameof(ErrorResponseDocument.Meta); @@ -106,25 +106,25 @@ public void Generated_resource_field_types_are_named_as_expected() _ = nameof(AttributesInCreateSupermarketRequest.Kind); _ = nameof(AttributesInUpdateSupermarketRequest.NameOfCity); _ = nameof(AttributesInUpdateSupermarketRequest.Kind); - _ = nameof(SupermarketAttributesInResponse.NameOfCity); - _ = nameof(SupermarketAttributesInResponse.Kind); + _ = nameof(AttributesInSupermarketResponse.NameOfCity); + _ = nameof(AttributesInSupermarketResponse.Kind); _ = nameof(RelationshipsInCreateSupermarketRequest.StoreManager); _ = nameof(RelationshipsInCreateSupermarketRequest.BackupStoreManager); _ = nameof(RelationshipsInCreateSupermarketRequest.Cashiers); _ = nameof(RelationshipsInUpdateSupermarketRequest.StoreManager); _ = nameof(RelationshipsInUpdateSupermarketRequest.BackupStoreManager); _ = nameof(RelationshipsInUpdateSupermarketRequest.Cashiers); - _ = nameof(SupermarketRelationshipsInResponse.StoreManager); - _ = nameof(SupermarketRelationshipsInResponse.BackupStoreManager); - _ = nameof(SupermarketRelationshipsInResponse.Cashiers); + _ = nameof(RelationshipsInSupermarketResponse.StoreManager); + _ = nameof(RelationshipsInSupermarketResponse.BackupStoreManager); + _ = nameof(RelationshipsInSupermarketResponse.Cashiers); _ = nameof(SupermarketType); _ = nameof(AttributesInCreateStaffMemberRequest.Name); _ = nameof(AttributesInCreateStaffMemberRequest.Age); _ = nameof(AttributesInUpdateStaffMemberRequest.Name); _ = nameof(AttributesInUpdateStaffMemberRequest.Age); - _ = nameof(StaffMemberAttributesInResponse.Name); - _ = nameof(StaffMemberAttributesInResponse.Age); + _ = nameof(AttributesInStaffMemberResponse.Name); + _ = nameof(AttributesInStaffMemberResponse.Age); } [Fact] @@ -170,17 +170,20 @@ public void Generated_operation_type_enums_are_named_as_expected() [Fact] public void Generated_data_types_are_named_as_expected() { - _ = nameof(DataInResponse.Meta); + _ = nameof(ResourceInCreateRequest.Meta); + _ = nameof(ResourceInUpdateRequest.Meta); + _ = nameof(IdentifierInRequest.Meta); + _ = nameof(ResourceInResponse.Meta); _ = nameof(DataInCreateSupermarketRequest.Meta); _ = nameof(DataInUpdateSupermarketRequest.Meta); - _ = nameof(SupermarketDataInResponse.Meta); + _ = nameof(DataInSupermarketResponse.Meta); _ = nameof(SupermarketIdentifierInRequest.Meta); _ = nameof(DataInCreateStaffMemberRequest.Meta); _ = nameof(DataInUpdateStaffMemberRequest.Meta); - _ = nameof(StaffMemberDataInResponse.Meta); + _ = nameof(DataInStaffMemberResponse.Meta); _ = nameof(StaffMemberIdentifierInRequest.Meta); _ = nameof(StaffMemberIdentifierInResponse.Meta); diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs index 3dbcc59133..e2cb3f9ed7 100644 --- a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs @@ -61,13 +61,13 @@ public async Task Can_create_resource_with_attributes() response.Should().NotBeNull(); response.Atomic_results.Should().HaveCount(1); - TeacherDataInResponse teacherDataInResponse = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + DataInTeacherResponse teacherData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; - teacherDataInResponse.Attributes.Should().NotBeNull(); - teacherDataInResponse.Attributes.Name.Should().Be(newTeacher.Name); - teacherDataInResponse.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); - long newTeacherId = long.Parse(teacherDataInResponse.Id); + long newTeacherId = long.Parse(teacherData.Id); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -136,14 +136,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.Atomic_results.Should().HaveCount(1); - EnrollmentDataInResponse enrollmentDataInResponse = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + DataInEnrollmentResponse enrollmentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; - enrollmentDataInResponse.Attributes.Should().NotBeNull(); - enrollmentDataInResponse.Attributes.EnrolledAt.Should().Be(newEnrollment.EnrolledAt.ToDateTime(TimeOnly.MinValue)); - enrollmentDataInResponse.Attributes.GraduatedAt.Should().BeNull(); - enrollmentDataInResponse.Attributes.HasGraduated.Should().BeFalse(); + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be(newEnrollment.EnrolledAt.ToDateTime(TimeOnly.MinValue)); + enrollmentData.Attributes.GraduatedAt.Should().BeNull(); + enrollmentData.Attributes.HasGraduated.Should().BeFalse(); - long newEnrollmentId = long.Parse(enrollmentDataInResponse.Id); + long newEnrollmentId = long.Parse(enrollmentData.Id); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs index 0dde1ba7e5..daf994d3bb 100644 --- a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs @@ -154,25 +154,25 @@ public async Task Can_use_local_IDs() response.Atomic_results.Should().HaveCount(7); - TeacherDataInResponse teacherInResponse = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; - teacherInResponse.Attributes.Should().NotBeNull(); - teacherInResponse.Attributes.Name.Should().Be(newTeacher.Name); - teacherInResponse.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); - long newTeacherId = long.Parse(teacherInResponse.Id); + DataInTeacherResponse teacherData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + long newTeacherId = long.Parse(teacherData.Id); response.Atomic_results.ElementAt(1).Data.Should().BeNull(); response.Atomic_results.ElementAt(2).Data.Should().BeNull(); - StudentDataInResponse studentInResponse = response.Atomic_results.ElementAt(3).Data.Should().BeOfType().Which; - studentInResponse.Attributes.Should().NotBeNull(); - studentInResponse.Attributes.Name.Should().Be(newStudent.Name); - studentInResponse.Attributes.EmailAddress.Should().Be(newStudent.EmailAddress); - long newStudentId = long.Parse(studentInResponse.Id); + DataInStudentResponse studentData = response.Atomic_results.ElementAt(3).Data.Should().BeOfType().Which; + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newStudent.EmailAddress); + long newStudentId = long.Parse(studentData.Id); - EnrollmentDataInResponse enrollmentInResponse = response.Atomic_results.ElementAt(4).Data.Should().BeOfType().Which; - enrollmentInResponse.Attributes.Should().NotBeNull(); - enrollmentInResponse.Attributes.EnrolledAt.Should().Be(newEnrolledAt.ToDateTime(TimeOnly.MinValue)); - long newEnrollmentId = long.Parse(enrollmentInResponse.Id); + DataInEnrollmentResponse enrollmentData = response.Atomic_results.ElementAt(4).Data.Should().BeOfType().Which; + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be(newEnrolledAt.ToDateTime(TimeOnly.MinValue)); + long newEnrollmentId = long.Parse(enrollmentData.Id); response.Atomic_results.ElementAt(5).Data.Should().BeNull(); response.Atomic_results.ElementAt(6).Data.Should().BeNull(); diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs index ee7d8a5c62..daf3704503 100644 --- a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs @@ -74,12 +74,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.Atomic_results.Should().HaveCount(1); - StudentDataInResponse studentDataInResponse = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + DataInStudentResponse studentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; - studentDataInResponse.Id.Should().Be(existingStudent.StringId); - studentDataInResponse.Attributes.Should().NotBeNull(); - studentDataInResponse.Attributes.Name.Should().Be(newName); - studentDataInResponse.Attributes.EmailAddress.Should().Be(newEmailAddress); + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newName); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -135,12 +135,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.Atomic_results.Should().HaveCount(1); - StudentDataInResponse studentDataInResponse = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + DataInStudentResponse studentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; - studentDataInResponse.Id.Should().Be(existingStudent.StringId); - studentDataInResponse.Attributes.Should().NotBeNull(); - studentDataInResponse.Attributes.Name.Should().Be(existingStudent.Name); - studentDataInResponse.Attributes.EmailAddress.Should().Be(newEmailAddress); + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(existingStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -214,13 +214,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Should().NotBeNull(); response.Atomic_results.Should().HaveCount(1); - EnrollmentDataInResponse enrollmentDataInResponse = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + DataInEnrollmentResponse enrollmentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; - enrollmentDataInResponse.Id.Should().Be(existingEnrollment.StringId); - enrollmentDataInResponse.Attributes.Should().NotBeNull(); - enrollmentDataInResponse.Attributes.EnrolledAt.Should().Be(newEnrolledAt.ToDateTime(TimeOnly.MinValue)); - enrollmentDataInResponse.Attributes.GraduatedAt.Should().Be(existingEnrollment.GraduatedAt!.Value.ToDateTime(TimeOnly.MinValue)); - enrollmentDataInResponse.Attributes.HasGraduated.Should().Be(existingEnrollment.HasGraduated); + enrollmentData.Id.Should().Be(existingEnrollment.StringId); + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be(newEnrolledAt.ToDateTime(TimeOnly.MinValue)); + enrollmentData.Attributes.GraduatedAt.Should().Be(existingEnrollment.GraduatedAt!.Value.ToDateTime(TimeOnly.MinValue)); + enrollmentData.Attributes.HasGraduated.Should().Be(existingEnrollment.HasGraduated); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/OpenApiNSwagEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs b/test/OpenApiNSwagEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs index 42924413bb..dc0d14d45c 100644 --- a/test/OpenApiNSwagEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs +++ b/test/OpenApiNSwagEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs @@ -88,7 +88,7 @@ public async Task Can_create_resource_with_ID_when_supplying_ID_is_required() }; // Act - PlayerPrimaryResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostPlayerAsync(requestBody)); + PrimaryPlayerResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostPlayerAsync(requestBody)); // Assert response.Should().BeNull(); @@ -123,7 +123,7 @@ public async Task Can_create_resource_without_ID_when_supplying_ID_is_allowed() }; // Act - GamePrimaryResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostGameAsync(requestBody)); + PrimaryGameResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostGameAsync(requestBody)); // Assert response.Should().NotBeNull(); @@ -162,7 +162,7 @@ public async Task Can_create_resource_with_ID_when_supplying_ID_is_allowed() }; // Act - GamePrimaryResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostGameAsync(requestBody)); + PrimaryGameResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostGameAsync(requestBody)); // Assert response.Should().BeNull(); @@ -240,7 +240,7 @@ public async Task Can_create_resource_without_ID_when_supplying_ID_is_forbidden( }; // Act - PlayerGroupPrimaryResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostPlayerGroupAsync(requestBody)); + PrimaryPlayerGroupResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostPlayerGroupAsync(requestBody)); // Assert response.Should().NotBeNull(); diff --git a/test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs b/test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs index 686b089ba2..88e9f84a01 100644 --- a/test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs +++ b/test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs @@ -128,7 +128,7 @@ public async Task Returns_no_ETag_for_POST_request() }; // Act - ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.PostCountryAsync(requestBody)); + ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.PostCountryAsync(requestBody)); // Assert response.StatusCode.Should().Be((int)HttpStatusCode.Created); diff --git a/test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs b/test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs index daf9c65248..b93912ea56 100644 --- a/test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs +++ b/test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs @@ -47,7 +47,7 @@ public async Task Returns_Location_for_post_resource_request() }; // Act - ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.PostCountryAsync(requestBody)); + ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.PostCountryAsync(requestBody)); // Assert response.StatusCode.Should().Be((int)HttpStatusCode.Created); diff --git a/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs b/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs index b1eba2cd2a..1166a8bc0d 100644 --- a/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs +++ b/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs @@ -43,7 +43,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }); // Act - ExcursionPrimaryResponseDocument response = await apiClient.GetExcursionAsync(excursion.StringId!); + PrimaryExcursionResponseDocument response = await apiClient.GetExcursionAsync(excursion.StringId!); // Assert response.Links.Describedby.Should().Be("/api-docs/v1/swagger.yaml"); diff --git a/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj index 00b75a4139..2fc34289fa 100644 --- a/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj +++ b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj @@ -71,5 +71,29 @@ %(Name)Client %(ClassName).cs + + OnlyRelationshipsInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + SubsetOfVariousInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + SubsetOfOperationsInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + NoOperationsInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs index e2c25c4f80..a7383e4fc0 100644 --- a/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs @@ -53,8 +53,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.ElementAt(0).Id.Should().Be(node.StringId); response.Included.Should().HaveCount(2); - 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); + 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] @@ -81,15 +81,15 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - NodePrimaryResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); // Assert response.Data.Id.Should().Be(node.StringId); response.Included.Should().HaveCount(3); - 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); + 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] @@ -122,8 +122,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Should().HaveCount(2); response.Included.Should().HaveCount(2); - response.Included.OfType().Should().ContainSingle(include => include.Id == node.StringId); - response.Included.OfType().Should().ContainSingle(include => 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] @@ -150,7 +150,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - NullableNodeSecondaryResponseDocument response = await apiClient.GetNodeParentAsync(node.StringId!, queryString); + NullableSecondaryNodeResponseDocument response = await apiClient.GetNodeParentAsync(node.StringId!, queryString); // Assert response.Data.Should().NotBeNull(); @@ -158,10 +158,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.Should().HaveCount(1); - response.Included.OfType().Should().ContainSingle(nodeData => nodeData.Id == node.Parent.Parent.StringId).Subject.With(nodeData => + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.Parent.StringId).Subject.With(include => { - nodeData.Attributes.Should().NotBeNull(); - nodeData.Attributes.Name.Should().Be(node.Parent.Parent.Name); + include.Attributes.Should().NotBeNull(); + include.Attributes.Name.Should().Be(node.Parent.Parent.Name); }); } @@ -186,7 +186,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - NodePrimaryResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); // Assert response.Data.Id.Should().Be(node.StringId); diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/SparseFieldSetTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/SparseFieldSetTests.cs index 85cf301088..ccd6e77bcc 100644 --- a/test/OpenApiNSwagEndToEndTests/QueryStrings/SparseFieldSetTests.cs +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/SparseFieldSetTests.cs @@ -81,7 +81,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - NodePrimaryResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); // Assert response.Data.Id.Should().Be(node.StringId); @@ -157,7 +157,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - NullableNodeSecondaryResponseDocument response = await apiClient.GetNodeParentAsync(node.StringId!, queryString); + NullableSecondaryNodeResponseDocument response = await apiClient.GetNodeParentAsync(node.StringId!, queryString); // Assert response.Data.Should().NotBeNull(); @@ -191,7 +191,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - NodePrimaryResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); // Assert response.Data.Id.Should().Be(node.StringId); diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs new file mode 100644 index 0000000000..7f6dcbbaaf --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs @@ -0,0 +1,951 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.NoOperationsInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.NoOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.NoOperations; + +public sealed class ResourceInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public ResourceInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_abstract_endpoint() + { + // Arrange + Residence residence = _fakers.Residence.GenerateOne(); + Mansion mansion = _fakers.Mansion.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(residence, mansion, familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + BuildingCollectionResponseDocument response = await apiClient.GetBuildingCollectionAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(3); + + response.Data.OfType().Should().ContainSingle(data => data.Id == residence.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == mansion.StringId).Subject.With(data => + { + AttributesInMansionResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == familyHome.StringId).Subject.With(data => + { + AttributesInFamilyHomeResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_base_endpoint() + { + // Arrange + Road road = _fakers.Road.GenerateOne(); + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Roads.AddRange(road, cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + RoadCollectionResponseDocument response = await apiClient.GetRoadCollectionAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == road.StringId).Subject.With(data => + { + AttributesInRoadResponse? attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(road.LengthInMeters); + + data.Relationships.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == cyclePath.StringId).Subject.With(data => + { + AttributesInCyclePathResponse attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + + data.Relationships.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome1 = _fakers.FamilyHome.GenerateOne(); + FamilyHome familyHome2 = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(familyHome1, familyHome2); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + FamilyHomeCollectionResponseDocument response = await apiClient.GetFamilyHomeCollectionAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == familyHome1.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome1.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome1.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.Should().ContainSingle(data => data.Id == familyHome2.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome2.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome2.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_abstract_endpoint() + { + // Arrange + Mansion mansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + PrimaryBuildingResponseDocument response = await apiClient.GetBuildingAsync(mansion.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(mansion.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_base_endpoint() + { + // Arrange + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + PrimaryRoadResponseDocument response = await apiClient.GetRoadAsync(cyclePath.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(cyclePath.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + }); + + response.Data.Relationships.Should().BeNull(); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + PrimaryFamilyHomeResponseDocument response = await apiClient.GetFamilyHomeAsync(familyHome.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(familyHome.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + SecondaryResidenceResponseDocument response = await apiClient.GetRoomResidenceAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + SecondaryResidenceResponseDocument response = await apiClient.GetBedroomResidenceAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + RoomCollectionResponseDocument response = await apiClient.GetResidenceRoomsAsync(familyHome.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId).Subject.With(data => + { + AttributesInKitchenResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(kitchen.SurfaceInSquareMeters); + attributes.HasPantry.Should().Be(kitchen.HasPantry); + + RelationshipsInKitchenResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId).Subject.With(data => + { + AttributesInBedroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bedroom.SurfaceInSquareMeters); + attributes.BedCount.Should().Be(bedroom.BedCount); + + RelationshipsInBedroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + RoomCollectionResponseDocument response = await apiClient.GetMansionRoomsAsync(mansion.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId).Subject.With(data => + { + AttributesInBathroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bathroom.SurfaceInSquareMeters); + attributes.HasBath.Should().Be(bathroom.HasBath); + + RelationshipsInBathroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId).Subject.With(data => + { + AttributesInToiletResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(toilet.SurfaceInSquareMeters); + attributes.HasSink.Should().Be(toilet.HasSink); + + RelationshipsInToiletResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_create_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + CreateRoadRequestDocument requestBody = new() + { + Data = new DataInCreateRoadRequest + { + Attributes = new AttributesInCreateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostRoadAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + long newRoadId = long.Parse(roadData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(newRoadId); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + CreateBuildingRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInCreateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom1.StringId! + }, + new BedroomIdentifierInRequest + { + Id = existingBedroom2.StringId! + }, + new LivingRoomIdentifierInRequest + { + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + var queryString = new Dictionary + { + ["include"] = "rooms" + }; + + // Act + PrimaryBuildingResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostBuildingAsync(requestBody, queryString)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + CreateResidenceRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryResidenceResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostResidenceAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_update_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + Road existingRoad = _fakers.Road.GenerateOne(); + + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(existingRoad); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + UpdateRoadRequestDocument requestBody = new() + { + Data = new DataInUpdateRoadRequest + { + Id = existingRoad.StringId!, + Attributes = new AttributesInUpdateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PatchRoadAsync(existingRoad.StringId!, requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(existingRoad.Id); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInUpdateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom1.StringId! + }, + new BedroomIdentifierInRequest + { + Id = existingBedroom2.StringId! + }, + new LivingRoomIdentifierInRequest + { + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + var queryString = new Dictionary + { + ["include"] = "rooms" + }; + + // Act + PrimaryBuildingResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBuildingAsync(existingFamilyHome.StringId!, requestBody, queryString)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryBuildingResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBuildingAsync(existingFamilyHome.StringId!, requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(1); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == existingFamilyHome.Rooms.ElementAt(0).Id); + }); + } + + [Fact] + public async Task Can_delete_concrete_derived_resource_at_abstract_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteBuildingAsync(existingMansion.StringId!)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome? familyHomeInDatabase = await dbContext.FamilyHomes.FirstWithIdOrDefaultAsync(existingMansion.Id); + + familyHomeInDatabase.Should().BeNull(); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs new file mode 100644 index 0000000000..9ad2ff8c41 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs @@ -0,0 +1,896 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.OnlyRelationshipsInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.OnlyRelationships; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.OnlyRelationships; + +public sealed class RelationshipInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public RelationshipInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + // GET /rooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + ResidenceIdentifierResponseDocument response = await apiClient.GetRoomResidenceRelationshipAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /bedrooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + ResidenceIdentifierResponseDocument response = await apiClient.GetBedroomResidenceRelationshipAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /residences/1/relationships/rooms => [kitchen, bedroom] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + RoomIdentifierCollectionResponseDocument response = await apiClient.GetResidenceRoomsRelationshipAsync(familyHome.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId); + } + + // GET /mansions/1/relationships/rooms => [bathroom, toilet] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + RoomIdentifierCollectionResponseDocument response = await apiClient.GetMansionRoomsRelationshipAsync(mansion.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId); + } + + // PATCH /rooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchRoomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /rooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchRoomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBathroomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBathroomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // DELETE /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs new file mode 100644 index 0000000000..617241854b --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs @@ -0,0 +1,326 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.SubsetOfOperationsInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.SubsetOfOperations; + +public sealed class OperationsInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public OperationsInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_use_inheritance_at_operations_endpoint() + { + // Arrange + StaffMember existingStaffMember = _fakers.StaffMember.GenerateOne(); + + Mansion newMansion = _fakers.Mansion.GenerateOne(); + Kitchen newKitchen = _fakers.Kitchen.GenerateOne(); + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + Bedroom newBedroom = _fakers.Bedroom.GenerateOne(); + int? newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.StaffMembers.Add(existingStaffMember); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new SubsetOfOperationsInheritanceClient(httpClient); + + const string mansionLid = "mansion-lid"; + const string kitchenLid = "kitchen-lid"; + const string familyHomeLid = "family-home-lid"; + const string bedroomLid = "bedroom-lid"; + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + // NOTE: CreateBuildingOperation is not generated, because it is turned off. + new CreateResidenceOperation + { + Data = new DataInCreateMansionRequest + { + Lid = mansionLid, + Attributes = new AttributesInCreateMansionRequest + { + SurfaceInSquareMeters = newMansion.SurfaceInSquareMeters!.Value, + NumberOfResidents = newMansion.NumberOfResidents!.Value, + OwnerName = newMansion.OwnerName + }, + Relationships = new RelationshipsInCreateMansionRequest + { + Staff = new ToManyStaffMemberInRequest + { + Data = + [ + new StaffMemberIdentifierInRequest + { + Id = existingStaffMember.StringId + } + ] + } + } + } + }, + // NOTE: It is possible to create an operation for abstract type. + new CreateRoomOperation + { + // NOTE: DataInCreateRoomRequest is generated, but as abstract type. + Data = new DataInCreateKitchenRequest + { + Lid = kitchenLid, + Attributes = new AttributesInCreateKitchenRequest + { + SurfaceInSquareMeters = newKitchen.SurfaceInSquareMeters!.Value, + HasPantry = newKitchen.HasPantry!.Value + }, + Relationships = new RelationshipsInCreateKitchenRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Lid = mansionLid + } + } + } + } + }, + new CreateFamilyHomeOperation + { + Data = new DataInCreateFamilyHomeRequest + { + Lid = familyHomeLid, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }, + new CreateBedroomOperation + { + Data = new DataInCreateBedroomRequest + { + Lid = bedroomLid, + Attributes = new AttributesInCreateBedroomRequest + { + SurfaceInSquareMeters = newBedroom.SurfaceInSquareMeters!.Value, + BedCount = newBedroom.BedCount!.Value + }, + Relationships = new RelationshipsInCreateBedroomRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new FamilyHomeIdentifierInRequest + { + Lid = familyHomeLid + } + } + } + } + }, + new AddToFamilyHomeRoomsRelationshipOperation + { + Ref = new FamilyHomeRoomsRelationshipIdentifier + { + Lid = familyHomeLid + }, + Data = + [ + new KitchenIdentifierInRequest + { + Lid = kitchenLid + } + ] + }, + new UpdateResidenceOperation + { + // NOTE: Can use Ref to base type, while Data is derived. + Ref = new ResidenceIdentifierInRequest + { + Lid = familyHomeLid + }, + Data = new DataInUpdateFamilyHomeRequest + { + Lid = familyHomeLid, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + }, + new RemoveFromMansionStaffRelationshipOperation + { + Ref = new MansionStaffRelationshipIdentifier + { + Lid = mansionLid + }, + Data = [] + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + response.Atomic_results.Should().HaveCount(7); + + DataInMansionResponse mansionData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Subject; + AttributesInMansionResponse mansionAttributes = mansionData.Attributes.Should().BeOfType().Subject; + mansionAttributes.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionAttributes.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionAttributes.OwnerName.Should().Be(newMansion.OwnerName); + mansionData.Relationships.Should().BeNull(); + + DataInKitchenResponse kitchenData = response.Atomic_results.ElementAt(1).Data.Should().BeOfType().Subject; + AttributesInKitchenResponse kitchenAttributes = kitchenData.Attributes.Should().BeOfType().Subject; + kitchenAttributes.SurfaceInSquareMeters.Should().Be(newKitchen.SurfaceInSquareMeters); + kitchenAttributes.HasPantry.Should().Be(newKitchen.HasPantry); + kitchenData.Relationships.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData2 = response.Atomic_results.ElementAt(2).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes2 = familyHomeData2.Attributes.Should().BeOfType().Subject; + familyHomeAttributes2.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes2.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes2.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData2.Relationships.Should().BeNull(); + + DataInBedroomResponse bedroomData = response.Atomic_results.ElementAt(3).Data.Should().BeOfType().Subject; + AttributesInBedroomResponse bedroomAttributes = bedroomData.Attributes.Should().BeOfType().Subject; + bedroomAttributes.SurfaceInSquareMeters.Should().Be(newBedroom.SurfaceInSquareMeters); + bedroomAttributes.BedCount.Should().Be(newBedroom.BedCount); + bedroomData.Relationships.Should().BeNull(); + + response.Atomic_results.ElementAt(4).Data.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData5 = response.Atomic_results.ElementAt(5).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes5 = familyHomeData5.Attributes.Should().BeOfType().Subject; + familyHomeAttributes5.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeAttributes5.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes5.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData5.Relationships.Should().BeNull(); + + response.Atomic_results.ElementAt(6).Data.Should().BeNull(); + + long newMansionId = long.Parse(mansionData.Id.Should().NotBeNull().And.Subject); + long newKitchenId = long.Parse(kitchenData.Id.Should().NotBeNull().And.Subject); + long newFamilyHomeId = long.Parse(familyHomeData2.Id.Should().NotBeNull().And.Subject); + long newBedroomId = long.Parse(bedroomData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Mansion mansionInDatabase = + await dbContext.Mansions.Include(mansion => mansion.Rooms).Include(mansion => mansion.Staff).FirstWithIdAsync(newMansionId); + + mansionInDatabase.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionInDatabase.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionInDatabase.OwnerName.Should().Be(newMansion.OwnerName); + + mansionInDatabase.Rooms.Should().BeEmpty(); + mansionInDatabase.Staff.Should().HaveCount(1); + mansionInDatabase.Staff.ElementAt(0).Id.Should().Be(existingStaffMember.Id); + + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(2); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == newKitchenId); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == newBedroomId); + }); + } + + [Fact] + public async Task Cannot_use_base_attributes_type_in_derived_data() + { + // Arrange + int newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters!.Value; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new SubsetOfOperationsInheritanceClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new CreateResidenceOperation + { + Data = new DataInCreateFamilyHomeRequest + { + Attributes = new AttributesInCreateResidenceRequest + { + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + } + ] + }; + + // Act + Func action = async () => await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.Conflict); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("409"); + error.Title.Should().Be("Incompatible resource type found."); + error.Detail.Should().Be("Expected openapi:discriminator with value 'familyHomes' instead of 'residences'."); + error.Source.Should().NotBeNull(); + error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/openapi:discriminator"); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs new file mode 100644 index 0000000000..5f853fd50a --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs @@ -0,0 +1,149 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.SubsetOfVariousInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfVarious; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.SubsetOfVarious; + +public sealed class IncludeTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public IncludeTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_include_in_primary_resources() + { + // Arrange + District district = _fakers.District.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(_fakers.LivingRoom.GenerateOne()); + familyHome.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(familyHome); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(_fakers.Kitchen.GenerateOne()); + mansion.Rooms.Add(_fakers.Bathroom.GenerateOne()); + mansion.Rooms.Add(_fakers.Toilet.GenerateOne()); + district.Buildings.Add(mansion); + + Residence residence = _fakers.Residence.GenerateOne(); + residence.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(residence); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Districts.Add(district); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new SubsetOfVariousInheritanceClient(httpClient); + + var queryString = new Dictionary + { + ["include"] = "buildings.rooms" + }; + + // Act + DistrictCollectionResponseDocument response = await apiClient.GetDistrictCollectionAsync(queryString); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(district.StringId); + + response.Included.Should().HaveCount(9); + + string familyHomeLivingRoomId = familyHome.Rooms.OfType().Single().StringId!; + string familyRoomBedroomId = familyHome.Rooms.OfType().Single().StringId!; + string mansionKitchenId = mansion.Rooms.OfType().Single().StringId!; + string mansionBathroomId = mansion.Rooms.OfType().Single().StringId!; + string mansionToiletId = mansion.Rooms.OfType().Single().StringId!; + string residenceBedroomId = residence.Rooms.OfType().Single().StringId!; + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHome.StringId).Subject.With(include => + { + AttributesInFamilyHomeResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(2); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyHomeLivingRoomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyRoomBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == mansion.StringId).Subject.With(include => + { + AttributesInMansionResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(3); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionKitchenId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionBathroomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionToiletId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == residence.StringId).Subject.With(include => + { + AttributesInResidenceResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(1); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == residenceBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHomeLivingRoomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == familyRoomBedroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionKitchenId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionBathroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionToiletId); + response.Included.OfType().Should().ContainSingle(include => include.Id == residenceBedroomId); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs index 145b058101..0fa4bec354 100644 --- a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -83,7 +83,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - WriteOnlyChannelPrimaryResponseDocument? response = + PrimaryWriteOnlyChannelResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostWriteOnlyChannelAsync(requestBody, queryString)); response.Should().NotBeNull(); @@ -103,18 +103,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.Should().HaveCount(2); - response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId).Subject.With( - streamData => + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId).Subject.With( + include => { - streamData.Attributes.Should().NotBeNull(); - streamData.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); }); - response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingAudioStream.StringId).Subject.With( - streamData => + response.Included.OfType().Should().ContainSingle(include => include.Id == existingAudioStream.StringId).Subject.With( + include => { - streamData.Attributes.Should().NotBeNull(); - streamData.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); }); long newChannelId = long.Parse(response.Data.Id.Should().NotBeNull().And.Subject); diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchResourceTests.cs index 9fc26c930a..3dfbeaa9cb 100644 --- a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchResourceTests.cs @@ -48,7 +48,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert response.Data.Should().HaveCount(2); - ReadOnlyChannelDataInResponse channel1 = response.Data.Single(channel => channel.Id == channels.ElementAt(0).StringId); + DataInReadOnlyChannelResponse channel1 = response.Data.Single(channel => channel.Id == channels.ElementAt(0).StringId); channel1.Attributes.Should().NotBeNull(); channel1.Attributes.Name.Should().Be(channels[0].Name); channel1.Attributes.IsCommercial.Should().Be(channels[0].IsCommercial); @@ -61,7 +61,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => channel1.Relationships.AudioStreams.Should().NotBeNull(); channel1.Relationships.AudioStreams.Data.Should().BeNull(); - ReadOnlyChannelDataInResponse channel2 = response.Data.Single(channel => channel.Id == channels.ElementAt(1).StringId); + DataInReadOnlyChannelResponse channel2 = response.Data.Single(channel => channel.Id == channels.ElementAt(1).StringId); channel2.Attributes.Should().NotBeNull(); channel2.Attributes.Name.Should().Be(channels[1].Name); channel2.Attributes.IsCommercial.Should().Be(channels[1].IsCommercial); @@ -92,7 +92,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => var apiClient = new RestrictedControllersClient(httpClient); // Act - ReadOnlyChannelPrimaryResponseDocument response = await apiClient.GetReadOnlyChannelAsync(channel.StringId!); + PrimaryReadOnlyChannelResponseDocument response = await apiClient.GetReadOnlyChannelAsync(channel.StringId!); // Assert response.Data.Should().NotBeNull(); @@ -151,7 +151,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => var apiClient = new RestrictedControllersClient(httpClient); // Act - DataStreamSecondaryResponseDocument response = await apiClient.GetReadOnlyChannelVideoStreamAsync(channel.StringId!); + SecondaryDataStreamResponseDocument response = await apiClient.GetReadOnlyChannelVideoStreamAsync(channel.StringId!); // Assert response.Data.Should().NotBeNull(); @@ -177,7 +177,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => var apiClient = new RestrictedControllersClient(httpClient); // Act - NullableDataStreamSecondaryResponseDocument response = await apiClient.GetReadOnlyChannelUltraHighDefinitionVideoStreamAsync(channel.StringId!); + NullableSecondaryDataStreamResponseDocument response = await apiClient.GetReadOnlyChannelUltraHighDefinitionVideoStreamAsync(channel.StringId!); // Assert response.Data.Should().BeNull(); @@ -206,11 +206,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => // Assert response.Data.Should().HaveCount(2); - DataStreamDataInResponse audioStream1 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); + DataInDataStreamResponse audioStream1 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); audioStream1.Attributes.Should().NotBeNull(); audioStream1.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(0).BytesTransmitted); - DataStreamDataInResponse audioStream2 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); + DataInDataStreamResponse audioStream2 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); audioStream2.Attributes.Should().NotBeNull(); audioStream2.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(1).BytesTransmitted); } diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs index dee210bc36..526f581898 100644 --- a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs @@ -90,7 +90,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - WriteOnlyChannelPrimaryResponseDocument? response = await ApiResponse.TranslateAsync(async () => + PrimaryWriteOnlyChannelResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PatchWriteOnlyChannelAsync(existingChannel.StringId!, requestBody, queryString)); response.Should().NotBeNull(); @@ -109,7 +109,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Relationships.AudioStreams.Data.Should().BeEmpty(); response.Included.Should().HaveCount(1); - response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId); await _testContext.RunOnDatabaseAsync(async dbContext => { @@ -167,7 +167,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => }; // Act - WriteOnlyChannelPrimaryResponseDocument? response = + PrimaryWriteOnlyChannelResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PatchWriteOnlyChannelAsync(existingChannel.StringId!, requestBody)); response.Should().NotBeNull(); diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json index 6d9f8b5b6d..cb64a5f34b 100644 --- a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json @@ -20,7 +20,7 @@ "requestBody": { "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "allOf": [ { @@ -36,7 +36,7 @@ "200": { "description": "All operations were successfully applied, which resulted in additional changes.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/operationsResponseDocument" } @@ -49,7 +49,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -59,7 +59,7 @@ "403": { "description": "An operation is not accessible or a client-generated ID is used.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -69,7 +69,7 @@ "404": { "description": "A resource or a related resource does not exist.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -79,7 +79,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -89,7 +89,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -360,7 +360,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } ] }, @@ -374,172 +374,280 @@ }, "additionalProperties": false }, - "attributesInCreateCourseRequest": { - "required": [ - "subject" + "attributesInCourseResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } ], - "type": "object", - "properties": { - "subject": { - "type": "string" + "additionalProperties": false + }, + "attributesInCreateCourseRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "description": { - "type": "string", - "nullable": true + { + "required": [ + "subject" + ], + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributesInCreateEnrollmentRequest": { - "type": "object", - "properties": { - "enrolledAt": { - "type": "string", - "format": "date" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "graduatedAt": { - "type": "string", - "format": "date", - "nullable": true + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInCreateStudentRequest": { + "attributesInCreateRequest": { "required": [ - "name" + "openapi:discriminator" ], "type": "object", "properties": { - "name": { - "type": "string" - }, - "emailAddress": { - "type": "string", - "nullable": true + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/attributesInCreateCourseRequest", + "enrollments": "#/components/schemas/attributesInCreateEnrollmentRequest", + "students": "#/components/schemas/attributesInCreateStudentRequest", + "teachers": "#/components/schemas/attributesInCreateTeacherRequest" } }, + "x-abstract": true + }, + "attributesInCreateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "attributesInCreateTeacherRequest": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "emailAddress": { - "type": "string", - "nullable": true + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateCourseRequest": { - "type": "object", - "properties": { - "subject": { - "type": "string" + "attributesInEnrollmentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "description": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + }, + "hasGraduated": { + "type": "boolean", + "readOnly": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateEnrollmentRequest": { + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "enrolledAt": { - "type": "string", - "format": "date" - }, - "graduatedAt": { - "type": "string", - "format": "date", - "nullable": true + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/attributesInCourseResponse", + "enrollments": "#/components/schemas/attributesInEnrollmentResponse", + "students": "#/components/schemas/attributesInStudentResponse", + "teachers": "#/components/schemas/attributesInTeacherResponse" + } + }, + "x-abstract": true }, - "attributesInUpdateStudentRequest": { - "type": "object", - "properties": { - "name": { - "type": "string" + "attributesInStudentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "emailAddress": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateTeacherRequest": { - "type": "object", - "properties": { - "name": { - "type": "string" + "attributesInTeacherResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "emailAddress": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "courseAttributesInResponse": { - "type": "object", - "properties": { - "subject": { - "type": "string" + "attributesInUpdateCourseRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "description": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "courseDataInResponse": { + "attributesInUpdateEnrollmentRequest": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/attributesInUpdateRequest" }, { - "required": [ - "id" - ], "type": "object", "properties": { - "id": { - "minLength": 1, + "enrolledAt": { "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/courseAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/courseRelationshipsInResponse" - } - ] + "format": "date" }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true } }, "additionalProperties": false @@ -547,47 +655,77 @@ ], "additionalProperties": false }, - "courseEnrollmentsRelationshipIdentifier": { + "attributesInUpdateRequest": { "required": [ - "relationship", - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/courseResourceType" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/attributesInUpdateCourseRequest", + "enrollments": "#/components/schemas/attributesInUpdateEnrollmentRequest", + "students": "#/components/schemas/attributesInUpdateStudentRequest", + "teachers": "#/components/schemas/attributesInUpdateTeacherRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "relationship": { - "allOf": [ - { - "$ref": "#/components/schemas/courseEnrollmentsRelationshipName" + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "courseEnrollmentsRelationshipName": { - "enum": [ - "enrollments" + "attributesInUpdateTeacherRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } ], - "type": "string" + "additionalProperties": false }, - "courseIdentifierInRequest": { + "courseEnrollmentsRelationshipIdentifier": { "required": [ + "relationship", "type" ], "type": "object", @@ -608,16 +746,46 @@ "minLength": 1, "type": "string" }, - "meta": { + "relationship": { "allOf": [ { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/courseEnrollmentsRelationshipName" } ] } }, "additionalProperties": false }, + "courseEnrollmentsRelationshipName": { + "enum": [ + "enrollments" + ], + "type": "string" + }, + "courseIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "courseIdentifierInResponse": { "required": [ "id", @@ -647,26 +815,6 @@ }, "additionalProperties": false }, - "courseRelationshipsInResponse": { - "type": "object", - "properties": { - "taughtBy": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTeacherInResponse" - } - ] - }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInResponse" - } - ] - } - }, - "additionalProperties": false - }, "courseResourceType": { "enum": [ "courses" @@ -840,387 +988,464 @@ ], "additionalProperties": false }, - "dataInCreateCourseRequest": { - "required": [ - "id", - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/courseResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateCourseRequest" - } - ] + "dataInCourseResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCourseResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCourseResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateCourseRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreateEnrollmentRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateEnrollmentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreateStudentRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/studentResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateStudentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreateTeacherRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateTeacherRequest" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEnrollmentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInEnrollmentResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInEnrollmentResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInStudentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStudentResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInStudentResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInResponse": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceType" - } - ] + "dataInTeacherResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTeacherResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInTeacherResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "courses": "#/components/schemas/courseDataInResponse", - "enrollments": "#/components/schemas/enrollmentDataInResponse", - "students": "#/components/schemas/studentDataInResponse", - "teachers": "#/components/schemas/teacherDataInResponse" + }, + "additionalProperties": false } - }, - "x-abstract": true + ], + "additionalProperties": false }, "dataInUpdateCourseRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/courseResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateCourseRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInUpdateEnrollmentRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateEnrollmentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInUpdateStudentRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/studentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateStudentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInUpdateTeacherRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateTeacherRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "deleteCourseOperation": { @@ -1319,25 +1544,6 @@ ], "additionalProperties": false }, - "enrollmentAttributesInResponse": { - "type": "object", - "properties": { - "enrolledAt": { - "type": "string", - "format": "date" - }, - "graduatedAt": { - "type": "string", - "format": "date", - "nullable": true - }, - "hasGraduated": { - "type": "boolean", - "readOnly": true - } - }, - "additionalProperties": false - }, "enrollmentCourseRelationshipIdentifier": { "required": [ "relationship", @@ -1377,15 +1583,13 @@ ], "type": "string" }, - "enrollmentDataInResponse": { + "enrollmentIdentifierInRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { - "required": [ - "id" - ], "type": "object", "properties": { "id": { @@ -1393,26 +1597,9 @@ "type": "string", "format": "int64" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "lid": { + "minLength": 1, + "type": "string" } }, "additionalProperties": false @@ -1420,38 +1607,6 @@ ], "additionalProperties": false }, - "enrollmentIdentifierInRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "enrollmentIdentifierInResponse": { "required": [ "id", @@ -1481,26 +1636,6 @@ }, "additionalProperties": false }, - "enrollmentRelationshipsInResponse": { - "type": "object", - "properties": { - "student": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStudentInResponse" - } - ] - }, - "course": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneCourseInResponse" - } - ] - } - }, - "additionalProperties": false - }, "enrollmentResourceType": { "enum": [ "enrollments" @@ -1675,6 +1810,39 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/courseIdentifierInRequest", + "enrollments": "#/components/schemas/enrollmentIdentifierInRequest", + "students": "#/components/schemas/studentIdentifierInRequest", + "teachers": "#/components/schemas/teacherIdentifierInRequest" + } + }, + "x-abstract": true + }, "jsonapi": { "type": "object", "properties": { @@ -1831,171 +1999,425 @@ "related": { "type": "string" } - }, + }, + "additionalProperties": false + }, + "relationshipsInCourseResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInResponse" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateCourseRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateEnrollmentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "course", + "student" + ], + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/relationshipsInCreateCourseRequest", + "enrollments": "#/components/schemas/relationshipsInCreateEnrollmentRequest", + "students": "#/components/schemas/relationshipsInCreateStudentRequest", + "teachers": "#/components/schemas/relationshipsInCreateTeacherRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateTeacherRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "relationshipsInCreateCourseRequest": { - "type": "object", - "properties": { - "taughtBy": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTeacherInRequest" - } - ] + "relationshipsInEnrollmentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInResponse" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInResponse" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationshipsInCreateEnrollmentRequest": { + "relationshipsInResponse": { "required": [ - "course", - "student" + "openapi:discriminator" ], "type": "object", "properties": { - "student": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStudentInRequest" - } - ] - }, - "course": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneCourseInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/relationshipsInCourseResponse", + "enrollments": "#/components/schemas/relationshipsInEnrollmentResponse", + "students": "#/components/schemas/relationshipsInStudentResponse", + "teachers": "#/components/schemas/relationshipsInTeacherResponse" + } + }, + "x-abstract": true }, - "relationshipsInCreateStudentRequest": { - "type": "object", - "properties": { - "mentor": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneTeacherInRequest" - } - ] + "relationshipsInStudentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInResponse" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInResponse" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationshipsInCreateTeacherRequest": { - "type": "object", - "properties": { - "teaches": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyCourseInRequest" - } - ] + "relationshipsInTeacherResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "mentors": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyStudentInRequest" + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInResponse" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInResponse" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationshipsInUpdateCourseRequest": { - "type": "object", - "properties": { - "taughtBy": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTeacherInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationshipsInUpdateEnrollmentRequest": { - "type": "object", - "properties": { - "student": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStudentInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "course": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneCourseInRequest" + { + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationshipsInUpdateStudentRequest": { + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "mentor": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/relationshipsInUpdateCourseRequest", + "enrollments": "#/components/schemas/relationshipsInUpdateEnrollmentRequest", + "students": "#/components/schemas/relationshipsInUpdateStudentRequest", + "teachers": "#/components/schemas/relationshipsInUpdateTeacherRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationshipsInUpdateTeacherRequest": { - "type": "object", - "properties": { - "teaches": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyCourseInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "mentors": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyStudentInRequest" + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "removeFromStudentEnrollmentsRelationshipOperation": { @@ -2109,17 +2531,116 @@ "$ref": "#/components/schemas/courseIdentifierInRequest" } } - }, - "additionalProperties": false + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInCreateCourseRequest", + "enrollments": "#/components/schemas/dataInCreateEnrollmentRequest", + "students": "#/components/schemas/dataInCreateStudentRequest", + "teachers": "#/components/schemas/dataInCreateTeacherRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" ], - "additionalProperties": false + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInCourseResponse", + "enrollments": "#/components/schemas/dataInEnrollmentResponse", + "students": "#/components/schemas/dataInStudentResponse", + "teachers": "#/components/schemas/dataInTeacherResponse" + } + }, + "x-abstract": true }, - "removeOperationCode": { - "enum": [ - "remove" + "resourceInUpdateRequest": { + "required": [ + "type" ], - "type": "string" + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInUpdateCourseRequest", + "enrollments": "#/components/schemas/dataInUpdateEnrollmentRequest", + "students": "#/components/schemas/dataInUpdateStudentRequest", + "teachers": "#/components/schemas/dataInUpdateTeacherRequest" + } + }, + "x-abstract": true }, "resourceLinks": { "type": "object", @@ -2151,62 +2672,6 @@ ], "type": "string" }, - "studentAttributesInResponse": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "emailAddress": { - "type": "string", - "nullable": true - } - }, - "additionalProperties": false - }, - "studentDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/studentAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/studentRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "studentEnrollmentsRelationshipIdentifier": { "required": [ "relationship", @@ -2247,35 +2712,27 @@ "type": "string" }, "studentIdentifierInRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/studentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "studentIdentifierInResponse": { @@ -2346,54 +2803,19 @@ ], "type": "string" }, - "studentRelationshipsInResponse": { - "type": "object", - "properties": { - "mentor": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneTeacherInResponse" - } - ] - }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInResponse" - } - ] - } - }, - "additionalProperties": false - }, "studentResourceType": { "enum": [ "students" ], "type": "string" }, - "teacherAttributesInResponse": { + "teacherIdentifierInRequest": { "type": "object", - "properties": { - "name": { - "type": "string" - }, - "emailAddress": { - "type": "string", - "nullable": true - } - }, - "additionalProperties": false - }, - "teacherDataInResponse": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { - "required": [ - "id" - ], "type": "object", "properties": { "id": { @@ -2401,26 +2823,9 @@ "type": "string", "format": "int64" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "lid": { + "minLength": 1, + "type": "string" } }, "additionalProperties": false @@ -2428,38 +2833,6 @@ ], "additionalProperties": false }, - "teacherIdentifierInRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "teacherIdentifierInResponse": { "required": [ "id", @@ -2528,26 +2901,6 @@ ], "type": "string" }, - "teacherRelationshipsInResponse": { - "type": "object", - "properties": { - "teaches": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyCourseInResponse" - } - ] - }, - "mentors": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyStudentInResponse" - } - ] - } - }, - "additionalProperties": false - }, "teacherResourceType": { "enum": [ "teachers" diff --git a/test/OpenApiTests/AtomicOperations/OperationsTests.cs b/test/OpenApiTests/AtomicOperations/OperationsTests.cs index efa747a551..10ca4ac399 100644 --- a/test/OpenApiTests/AtomicOperations/OperationsTests.cs +++ b/test/OpenApiTests/AtomicOperations/OperationsTests.cs @@ -39,7 +39,7 @@ public async Task Operations_endpoint_is_exposed() "requestBody": { "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "allOf": [ { @@ -55,7 +55,7 @@ public async Task Operations_endpoint_is_exposed() "200": { "description": "All operations were successfully applied, which resulted in additional changes.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/operationsResponseDocument" } @@ -68,7 +68,7 @@ public async Task Operations_endpoint_is_exposed() "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -78,7 +78,7 @@ public async Task Operations_endpoint_is_exposed() "403": { "description": "An operation is not accessible or a client-generated ID is used.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -88,7 +88,7 @@ public async Task Operations_endpoint_is_exposed() "404": { "description": "A resource or a related resource does not exist.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -98,7 +98,7 @@ public async Task Operations_endpoint_is_exposed() "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -108,7 +108,7 @@ public async Task Operations_endpoint_is_exposed() "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,6 +235,126 @@ public async Task Operations_request_component_schemas_are_exposed() "type": "string" } """); + + schemasElement.Should().ContainPath("resourceInCreateRequest").Should().BeJson(""" + { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInCreateCourseRequest", + "enrollments": "#/components/schemas/dataInCreateEnrollmentRequest", + "students": "#/components/schemas/dataInCreateStudentRequest", + "teachers": "#/components/schemas/dataInCreateTeacherRequest" + } + }, + "x-abstract": true + } + """); + + schemasElement.Should().ContainPath("resourceInUpdateRequest").Should().BeJson(""" + { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInUpdateCourseRequest", + "enrollments": "#/components/schemas/dataInUpdateEnrollmentRequest", + "students": "#/components/schemas/dataInUpdateStudentRequest", + "teachers": "#/components/schemas/dataInUpdateTeacherRequest" + } + }, + "x-abstract": true + } + """); + + schemasElement.Should().ContainPath("identifierInRequest").Should().BeJson(""" + { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/courseIdentifierInRequest", + "enrollments": "#/components/schemas/enrollmentIdentifierInRequest", + "students": "#/components/schemas/studentIdentifierInRequest", + "teachers": "#/components/schemas/teacherIdentifierInRequest" + } + }, + "x-abstract": true + } + """); + + schemasElement.Should().ContainPath("resourceType").Should().BeJson(""" + { + "enum": [ + "courses", + "enrollments", + "students", + "teachers" + ], + "type": "string" + } + """); }); } @@ -295,7 +415,7 @@ public async Task Operations_response_component_schemas_are_exposed() "data": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } ] }, @@ -360,88 +480,98 @@ public async Task Course_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInCreateCourseRequest").Should().BeJson(""" { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/courseResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateCourseRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInCreateCourseRequest").Should().BeJson(""" { - "required": [ - "subject" - ], - "type": "object", - "properties": { - "subject": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "description": { - "type": "string", - "nullable": true + { + "required": [ + "subject" + ], + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInCreateCourseRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "taughtBy": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTeacherInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -490,88 +620,96 @@ public async Task Course_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInUpdateCourseRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/courseResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateCourseRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInUpdateCourseRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "subject": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "description": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInUpdateCourseRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "taughtBy": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyTeacherInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -689,49 +827,41 @@ public async Task Course_operation_component_schemas_are_exposed() } } }, - "additionalProperties": false - } - ], - "additionalProperties": false - } - """); - - schemasElement.Should().NotContainPath("removeFromCourseEnrollmentsRelationshipOperation"); - - schemasElement.Should().NotContainPath("updateCourseTaughtByRelationshipOperation"); - - // shared types - schemasElement.Should().ContainPath("courseIdentifierInRequest").Should().BeJson(""" - { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/courseResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "lid": { - "minLength": 1, - "type": "string" + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().NotContainPath("removeFromCourseEnrollmentsRelationshipOperation"); + + schemasElement.Should().NotContainPath("updateCourseTaughtByRelationshipOperation"); + + // shared types + schemasElement.Should().ContainPath("courseIdentifierInRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -830,86 +960,94 @@ public async Task Student_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInCreateStudentRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/studentResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateStudentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInCreateStudentRequest").Should().BeJson(""" { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "emailAddress": { - "type": "string", - "nullable": true + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInCreateStudentRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "mentor": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneTeacherInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -958,88 +1096,96 @@ public async Task Student_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInUpdateStudentRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/studentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateStudentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInUpdateStudentRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "name": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "emailAddress": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInUpdateStudentRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "mentor": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneTeacherInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "enrollments": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEnrollmentInRequest" + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -1206,49 +1352,41 @@ public async Task Student_operation_component_schemas_are_exposed() "data": { "type": "array", "items": { - "$ref": "#/components/schemas/enrollmentIdentifierInRequest" - } - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - } - """); - - // shared types - schemasElement.Should().ContainPath("studentIdentifierInRequest").Should().BeJson(""" - { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/studentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // shared types + schemasElement.Should().ContainPath("studentIdentifierInRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -1392,86 +1530,94 @@ public async Task Teacher_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInCreateTeacherRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateTeacherRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInCreateTeacherRequest").Should().BeJson(""" { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "emailAddress": { - "type": "string", - "nullable": true + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInCreateTeacherRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "teaches": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyCourseInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "mentors": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyStudentInRequest" + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -1520,88 +1666,96 @@ public async Task Teacher_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInUpdateTeacherRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateTeacherRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInUpdateTeacherRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "name": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "emailAddress": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInUpdateTeacherRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "teaches": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyCourseInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "mentors": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyStudentInRequest" + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -1757,49 +1911,41 @@ public async Task Teacher_operation_component_schemas_are_exposed() "data": { "type": "array", "items": { - "$ref": "#/components/schemas/studentIdentifierInRequest" - } - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - } - """); - - // shared types - schemasElement.Should().ContainPath("teacherIdentifierInRequest").Should().BeJson(""" - { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/teacherResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // shared types + schemasElement.Should().ContainPath("teacherIdentifierInRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -1898,89 +2044,97 @@ public async Task Enrollment_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInCreateEnrollmentRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateEnrollmentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInCreateEnrollmentRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "enrolledAt": { - "type": "string", - "format": "date" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "graduatedAt": { - "type": "string", - "format": "date", - "nullable": true + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInCreateEnrollmentRequest").Should().BeJson(""" { - "required": [ - "course", - "student" - ], - "type": "object", - "properties": { - "student": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStudentInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "course": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneCourseInRequest" + { + "required": [ + "course", + "student" + ], + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -2029,90 +2183,98 @@ public async Task Enrollment_operation_component_schemas_are_exposed() schemasElement.Should().ContainPath("dataInUpdateEnrollmentRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateEnrollmentRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("attributesInUpdateEnrollmentRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "enrolledAt": { - "type": "string", - "format": "date" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "graduatedAt": { - "type": "string", - "format": "date", - "nullable": true + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); schemasElement.Should().ContainPath("relationshipsInUpdateEnrollmentRequest").Should().BeJson(""" { - "type": "object", - "properties": { - "student": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStudentInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "course": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneCourseInRequest" + { + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); @@ -2199,35 +2361,27 @@ public async Task Enrollment_operation_component_schemas_are_exposed() // shared types schemasElement.Should().ContainPath("enrollmentIdentifierInRequest").Should().BeJson(""" { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/enrollmentResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "lid": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false } """); diff --git a/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs index 72d719ba3b..f68dead88a 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs +++ b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs @@ -26,7 +26,7 @@ public async Task Schema_property_for_ID_is_required_in_post_request() JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.dataInCreatePlayerRequest").With(dataElement => + document.Should().ContainPath("components.schemas.dataInCreatePlayerRequest.allOf[1]").With(dataElement => { dataElement.Should().ContainPath("required").With(requiredElement => { @@ -45,15 +45,9 @@ public async Task Schema_property_for_ID_is_optional_in_post_request() JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.dataInCreateGameRequest").With(dataElement => + document.Should().ContainPath("components.schemas.dataInCreateGameRequest.allOf[1]").With(dataElement => { - dataElement.Should().ContainPath("required").With(requiredElement => - { - requiredElement.Should().NotContainArrayElement("id"); - requiredElement.Should().NotContainArrayElement("lid"); - }); - - dataElement.Should().ContainPath("properties.id"); + dataElement.Should().NotContainPath("required"); }); } @@ -64,15 +58,9 @@ public async Task Schema_property_for_ID_is_omitted_in_post_request() JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.dataInCreatePlayerGroupRequest").With(dataElement => + document.Should().ContainPath("components.schemas.dataInCreatePlayerGroupRequest.allOf[1]").With(dataElement => { - dataElement.Should().ContainPath("required").With(requiredElement => - { - requiredElement.Should().NotContainArrayElement("id"); - requiredElement.Should().NotContainArrayElement("lid"); - }); - - dataElement.Should().NotContainPath("properties.id"); + dataElement.Should().NotContainPath("required"); }); } } diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json index 4db734c7e9..0a32442e86 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json @@ -35,7 +35,7 @@ "requestBody": { "description": "The attributes and relationships of the game to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -61,9 +61,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/gamePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryGameResponseDocument" } } } @@ -74,7 +74,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -84,7 +84,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -94,7 +94,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -104,7 +104,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -139,7 +139,7 @@ "requestBody": { "description": "The attributes and relationships of the playerGroup to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -165,9 +165,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/playerGroupPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryPlayerGroupResponseDocument" } } } @@ -178,7 +178,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -188,7 +188,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -198,7 +198,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -208,7 +208,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -218,7 +218,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -253,7 +253,7 @@ "requestBody": { "description": "The attributes and relationships of the player to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -279,9 +279,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/playerPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryPlayerResponseDocument" } } } @@ -292,7 +292,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -302,7 +302,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -312,7 +312,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -322,7 +322,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -336,44 +336,173 @@ "components": { "schemas": { "attributesInCreateGameRequest": { - "required": [ - "title" - ], - "type": "object", - "properties": { - "title": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "purchasePrice": { - "type": "number", - "format": "double" + { + "required": [ + "title" + ], + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "purchasePrice": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributesInCreatePlayerGroupRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreatePlayerRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "userName" + ], + "type": "object", + "properties": { + "userName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { "required": [ - "name" + "openapi:discriminator" ], "type": "object", "properties": { - "name": { - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "games": "#/components/schemas/attributesInCreateGameRequest", + "playerGroups": "#/components/schemas/attributesInCreatePlayerGroupRequest", + "players": "#/components/schemas/attributesInCreatePlayerRequest" + } + }, + "x-abstract": true + }, + "attributesInGameResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "purchasePrice": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "attributesInCreatePlayerRequest": { + "attributesInPlayerGroupResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInPlayerResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "userName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { "required": [ - "userName" + "openapi:discriminator" ], "type": "object", "properties": { - "userName": { - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "games": "#/components/schemas/attributesInGameResponse", + "playerGroups": "#/components/schemas/attributesInPlayerGroupResponse", + "players": "#/components/schemas/attributesInPlayerResponse" + } + }, + "x-abstract": true }, "createGameRequestDocument": { "required": [ @@ -445,151 +574,219 @@ "additionalProperties": false }, "dataInCreateGameRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/gameResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateGameRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateGameRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreatePlayerGroupRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/playerGroupResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreatePlayerGroupRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreatePlayerGroupRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreatePlayerGroupRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreatePlayerGroupRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreatePlayerRequest": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/playerResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreatePlayerRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreatePlayerRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreatePlayerRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInGameResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreatePlayerRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInGameResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInPlayerGroupResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInPlayerGroupResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInPlayerGroupResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInResponse": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceType" - } - ] + "dataInPlayerResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInPlayerResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInPlayerResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "games": "#/components/schemas/gameDataInResponse", - "playerGroups": "#/components/schemas/playerGroupDataInResponse", - "players": "#/components/schemas/playerDataInResponse" + }, + "additionalProperties": false } - }, - "x-abstract": true + ], + "additionalProperties": false }, "errorLinks": { "type": "object", @@ -713,23 +910,11 @@ }, "additionalProperties": false }, - "gameAttributesInResponse": { + "gameIdentifierInRequest": { "type": "object", - "properties": { - "title": { - "type": "string" - }, - "purchasePrice": { - "type": "number", - "format": "double" - } - }, - "additionalProperties": false - }, - "gameDataInResponse": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { "required": [ @@ -741,20 +926,6 @@ "minLength": 1, "type": "string", "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/gameAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] } }, "additionalProperties": false @@ -762,7 +933,7 @@ ], "additionalProperties": false }, - "gameIdentifierInRequest": { + "gameIdentifierInResponse": { "required": [ "id", "type" @@ -791,9 +962,14 @@ }, "additionalProperties": false }, - "gameIdentifierInResponse": { + "gameResourceType": { + "enum": [ + "games" + ], + "type": "string" + }, + "identifierInRequest": { "required": [ - "id", "type" ], "type": "object", @@ -801,15 +977,10 @@ "type": { "allOf": [ { - "$ref": "#/components/schemas/gameResourceType" + "$ref": "#/components/schemas/resourceType" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, "meta": { "allOf": [ { @@ -818,50 +989,16 @@ ] } }, - "additionalProperties": false - }, - "gamePrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/gameDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "games": "#/components/schemas/gameIdentifierInRequest", + "playerGroups": "#/components/schemas/playerGroupIdentifierInRequest", + "players": "#/components/schemas/playerIdentifierInRequest" } }, - "additionalProperties": false - }, - "gameResourceType": { - "enum": [ - "games" - ], - "type": "string" + "x-abstract": true }, "meta": { "type": "object", @@ -869,19 +1006,11 @@ "nullable": true } }, - "playerAttributesInResponse": { + "playerGroupIdentifierInRequest": { "type": "object", - "properties": { - "userName": { - "type": "string" - } - }, - "additionalProperties": false - }, - "playerDataInResponse": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { "required": [ @@ -892,28 +1021,7 @@ "id": { "minLength": 1, "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/playerAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/playerRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "format": "int64" } }, "additionalProperties": false @@ -921,19 +1029,46 @@ ], "additionalProperties": false }, - "playerGroupAttributesInResponse": { + "playerGroupIdentifierInResponse": { + "required": [ + "id", + "type" + ], "type": "object", "properties": { - "name": { - "type": "string" + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/playerGroupResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false }, - "playerGroupDataInResponse": { + "playerGroupResourceType": { + "enum": [ + "playerGroups" + ], + "type": "string" + }, + "playerIdentifierInRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { "required": [ @@ -944,28 +1079,7 @@ "id": { "minLength": 1, "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/playerGroupAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/playerGroupRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "format": "uuid" } }, "additionalProperties": false @@ -973,7 +1087,7 @@ ], "additionalProperties": false }, - "playerGroupIdentifierInRequest": { + "playerIdentifierInResponse": { "required": [ "id", "type" @@ -983,14 +1097,14 @@ "type": { "allOf": [ { - "$ref": "#/components/schemas/playerGroupResourceType" + "$ref": "#/components/schemas/playerResourceType" } ] }, "id": { "minLength": 1, "type": "string", - "format": "int64" + "format": "uuid" }, "meta": { "allOf": [ @@ -1002,36 +1116,13 @@ }, "additionalProperties": false }, - "playerGroupIdentifierInResponse": { - "required": [ - "id", - "type" + "playerResourceType": { + "enum": [ + "players" ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/playerGroupResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false + "type": "string" }, - "playerGroupPrimaryResponseDocument": { + "primaryGameResponseDocument": { "required": [ "data", "links" @@ -1048,14 +1139,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/playerGroupDataInResponse" + "$ref": "#/components/schemas/dataInGameResponse" } ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -1068,72 +1159,32 @@ }, "additionalProperties": false }, - "playerGroupRelationshipsInResponse": { - "type": "object", - "properties": { - "players": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyPlayerInResponse" - } - ] - } - }, - "additionalProperties": false - }, - "playerGroupResourceType": { - "enum": [ - "playerGroups" - ], - "type": "string" - }, - "playerIdentifierInRequest": { + "primaryPlayerGroupResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/playerResourceType" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "playerIdentifierInResponse": { - "required": [ - "id", - "type" - ], - "type": "object", - "properties": { - "type": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/playerResourceType" + "$ref": "#/components/schemas/dataInPlayerGroupResponse" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -1145,7 +1196,7 @@ }, "additionalProperties": false }, - "playerPrimaryResponseDocument": { + "primaryPlayerResponseDocument": { "required": [ "data", "links" @@ -1162,14 +1213,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/playerDataInResponse" + "$ref": "#/components/schemas/dataInPlayerResponse" } ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -1182,76 +1233,227 @@ }, "additionalProperties": false }, - "playerRelationshipsInResponse": { + "relationshipLinks": { "type": "object", "properties": { - "ownedGames": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyGameInResponse" + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreatePlayerGroupRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "players": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerInRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreatePlayerRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "memberOf": { + { + "type": "object", + "properties": { + "ownedGames": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyGameInRequest" + } + ] + }, + "memberOf": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerGroupInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyPlayerGroupInResponse" + "$ref": "#/components/schemas/resourceType" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "playerGroups": "#/components/schemas/relationshipsInCreatePlayerGroupRequest", + "players": "#/components/schemas/relationshipsInCreatePlayerRequest" + } + }, + "x-abstract": true + }, + "relationshipsInPlayerGroupResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "players": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "playerResourceType": { - "enum": [ - "players" + "relationshipsInPlayerResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "ownedGames": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyGameInResponse" + } + ] + }, + "memberOf": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerGroupInResponse" + } + ] + } + }, + "additionalProperties": false + } ], - "type": "string" + "additionalProperties": false }, - "relationshipLinks": { + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "self": { - "type": "string" - }, - "related": { - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "playerGroups": "#/components/schemas/relationshipsInPlayerGroupResponse", + "players": "#/components/schemas/relationshipsInPlayerResponse" + } + }, + "x-abstract": true }, - "relationshipsInCreatePlayerGroupRequest": { + "resourceInCreateRequest": { + "required": [ + "type" + ], "type": "object", "properties": { - "players": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/toManyPlayerInRequest" + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "games": "#/components/schemas/dataInCreateGameRequest", + "playerGroups": "#/components/schemas/dataInCreatePlayerGroupRequest", + "players": "#/components/schemas/dataInCreatePlayerRequest" + } + }, + "x-abstract": true }, - "relationshipsInCreatePlayerRequest": { + "resourceInResponse": { + "required": [ + "type" + ], "type": "object", "properties": { - "ownedGames": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/toManyGameInRequest" + "$ref": "#/components/schemas/resourceType" } ] }, - "memberOf": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyPlayerGroupInRequest" + "$ref": "#/components/schemas/meta" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "games": "#/components/schemas/dataInGameResponse", + "playerGroups": "#/components/schemas/dataInPlayerGroupResponse", + "players": "#/components/schemas/dataInPlayerResponse" + } + }, + "x-abstract": true }, "resourceLinks": { "type": "object", diff --git a/test/OpenApiTests/Documentation/DocumentationTests.cs b/test/OpenApiTests/Documentation/DocumentationTests.cs index 5b6298c1cb..949df2e023 100644 --- a/test/OpenApiTests/Documentation/DocumentationTests.cs +++ b/test/OpenApiTests/Documentation/DocumentationTests.cs @@ -623,15 +623,15 @@ public async Task Resource_types_are_documented() { schemasElement.Should().HaveProperty("dataInUpdateElevatorRequest.description", "An elevator within a skyscraper."); schemasElement.Should().HaveProperty("dataInCreateElevatorRequest.description", "An elevator within a skyscraper."); - schemasElement.Should().HaveProperty("elevatorDataInResponse.description", "An elevator within a skyscraper."); + schemasElement.Should().HaveProperty("dataInElevatorResponse.description", "An elevator within a skyscraper."); schemasElement.Should().HaveProperty("dataInUpdateSkyscraperRequest.description", "A tall, continuously habitable building having multiple floors."); schemasElement.Should().HaveProperty("dataInCreateSkyscraperRequest.description", "A tall, continuously habitable building having multiple floors."); - schemasElement.Should().HaveProperty("skyscraperDataInResponse.description", "A tall, continuously habitable building having multiple floors."); + schemasElement.Should().HaveProperty("dataInSkyscraperResponse.description", "A tall, continuously habitable building having multiple floors."); schemasElement.Should().HaveProperty("dataInUpdateSpaceRequest.description", "A space within a skyscraper, such as an office, hotel, residential space, or retail space."); schemasElement.Should().HaveProperty("dataInCreateSpaceRequest.description", "A space within a skyscraper, such as an office, hotel, residential space, or retail space."); - schemasElement.Should().HaveProperty("spaceDataInResponse.description", "A space within a skyscraper, such as an office, hotel, residential space, or retail space."); + schemasElement.Should().HaveProperty("dataInSpaceResponse.description", "A space within a skyscraper, such as an office, hotel, residential space, or retail space."); }); } @@ -644,27 +644,27 @@ public async Task Attributes_are_documented() // Assert document.Should().ContainPath("components.schemas").With(schemasElement => { - schemasElement.Should().HaveProperty("attributesInUpdateElevatorRequest.properties.floorCount.description", "The number of floors this elevator provides access to."); - schemasElement.Should().HaveProperty("attributesInCreateElevatorRequest.properties.floorCount.description", "The number of floors this elevator provides access to."); - schemasElement.Should().HaveProperty("elevatorAttributesInResponse.properties.floorCount.description", "The number of floors this elevator provides access to."); + schemasElement.Should().HaveProperty("attributesInUpdateElevatorRequest.allOf[1].properties.floorCount.description", "The number of floors this elevator provides access to."); + schemasElement.Should().HaveProperty("attributesInCreateElevatorRequest.allOf[1].properties.floorCount.description", "The number of floors this elevator provides access to."); + schemasElement.Should().HaveProperty("attributesInElevatorResponse.allOf[1].properties.floorCount.description", "The number of floors this elevator provides access to."); - schemasElement.Should().HaveProperty("attributesInUpdateSkyscraperRequest.properties.heightInMeters.description", "The height of this building, in meters."); - schemasElement.Should().HaveProperty("attributesInCreateSkyscraperRequest.properties.heightInMeters.description", "The height of this building, in meters."); - schemasElement.Should().HaveProperty("skyscraperAttributesInResponse.properties.heightInMeters.description", "The height of this building, in meters."); + schemasElement.Should().HaveProperty("attributesInUpdateSkyscraperRequest.allOf[1].properties.heightInMeters.description", "The height of this building, in meters."); + schemasElement.Should().HaveProperty("attributesInCreateSkyscraperRequest.allOf[1].properties.heightInMeters.description", "The height of this building, in meters."); + schemasElement.Should().HaveProperty("attributesInSkyscraperResponse.allOf[1].properties.heightInMeters.description", "The height of this building, in meters."); - schemasElement.Should().ContainPath("attributesInUpdateSpaceRequest.properties").With(propertiesElement => + schemasElement.Should().ContainPath("attributesInUpdateSpaceRequest.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().HaveProperty("floorNumber.description", "The floor number on which this space resides."); propertiesElement.Should().HaveProperty("kind.description", "The kind of this space."); }); - schemasElement.Should().ContainPath("attributesInCreateSpaceRequest.properties").With(propertiesElement => + schemasElement.Should().ContainPath("attributesInCreateSpaceRequest.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().HaveProperty("floorNumber.description", "The floor number on which this space resides."); propertiesElement.Should().HaveProperty("kind.description", "The kind of this space."); }); - schemasElement.Should().ContainPath("spaceAttributesInResponse.properties").With(propertiesElement => + schemasElement.Should().ContainPath("attributesInSpaceResponse.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().HaveProperty("floorNumber.description", "The floor number on which this space resides."); propertiesElement.Should().HaveProperty("kind.description", "The kind of this space."); @@ -681,31 +681,31 @@ public async Task Relationships_are_documented() // Assert document.Should().ContainPath("components.schemas").With(schemasElement => { - schemasElement.Should().HaveProperty("relationshipsInUpdateElevatorRequest.properties.existsIn.description", "The skyscraper this elevator exists in."); - schemasElement.Should().HaveProperty("relationshipsInCreateElevatorRequest.properties.existsIn.description", "The skyscraper this elevator exists in."); - schemasElement.Should().HaveProperty("elevatorRelationshipsInResponse.properties.existsIn.description", "The skyscraper this elevator exists in."); + schemasElement.Should().HaveProperty("relationshipsInUpdateElevatorRequest.allOf[1].properties.existsIn.description", "The skyscraper this elevator exists in."); + schemasElement.Should().HaveProperty("relationshipsInCreateElevatorRequest.allOf[1].properties.existsIn.description", "The skyscraper this elevator exists in."); + schemasElement.Should().HaveProperty("relationshipsInElevatorResponse.allOf[1].properties.existsIn.description", "The skyscraper this elevator exists in."); - schemasElement.Should().ContainPath("relationshipsInUpdateSkyscraperRequest.properties").With(propertiesElement => + schemasElement.Should().ContainPath("relationshipsInUpdateSkyscraperRequest.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().HaveProperty("elevator.description", "An optional elevator within this building, providing access to spaces."); propertiesElement.Should().HaveProperty("spaces.description", "The spaces within this building."); }); - schemasElement.Should().ContainPath("relationshipsInCreateSkyscraperRequest.properties").With(propertiesElement => + schemasElement.Should().ContainPath("relationshipsInCreateSkyscraperRequest.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().HaveProperty("elevator.description", "An optional elevator within this building, providing access to spaces."); propertiesElement.Should().HaveProperty("spaces.description", "The spaces within this building."); }); - schemasElement.Should().ContainPath("skyscraperRelationshipsInResponse.properties").With(propertiesElement => + schemasElement.Should().ContainPath("relationshipsInSkyscraperResponse.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().HaveProperty("elevator.description", "An optional elevator within this building, providing access to spaces."); propertiesElement.Should().HaveProperty("spaces.description", "The spaces within this building."); }); - schemasElement.Should().HaveProperty("relationshipsInUpdateSpaceRequest.properties.existsIn.description", "The skyscraper this space exists in."); - schemasElement.Should().HaveProperty("relationshipsInCreateSpaceRequest.properties.existsIn.description", "The skyscraper this space exists in."); - schemasElement.Should().HaveProperty("spaceRelationshipsInResponse.properties.existsIn.description", "The skyscraper this space exists in."); + schemasElement.Should().HaveProperty("relationshipsInUpdateSpaceRequest.allOf[1].properties.existsIn.description", "The skyscraper this space exists in."); + schemasElement.Should().HaveProperty("relationshipsInCreateSpaceRequest.allOf[1].properties.existsIn.description", "The skyscraper this space exists in."); + schemasElement.Should().HaveProperty("relationshipsInSpaceResponse.allOf[1].properties.existsIn.description", "The skyscraper this space exists in."); }); } diff --git a/test/OpenApiTests/Documentation/ErrorResponseTests.cs b/test/OpenApiTests/Documentation/ErrorResponseTests.cs index 1445cbac82..0b72664f5d 100644 --- a/test/OpenApiTests/Documentation/ErrorResponseTests.cs +++ b/test/OpenApiTests/Documentation/ErrorResponseTests.cs @@ -7,8 +7,8 @@ namespace OpenApiTests.Documentation; public sealed class ErrorResponseTests : IClassFixture, DocumentationDbContext>> { - private const string EscapedJsonApiMediaType = "['application/vnd.api+json']"; - private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic']"; + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; private readonly OpenApiTestContext, DocumentationDbContext> _testContext; diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json index ff402710af..735ed22d80 100644 --- a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/countryCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the country to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/countryPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryCountryResponseDocument" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -319,9 +319,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/countryPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryCountryResponseDocument" } } } @@ -341,7 +341,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -351,7 +351,7 @@ "404": { "description": "The country does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -477,7 +477,7 @@ "requestBody": { "description": "The attributes and relationships of the country to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -493,9 +493,9 @@ "200": { "description": "The country was successfully updated, which resulted in additional changes. The updated country is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/countryPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryCountryResponseDocument" } } } @@ -506,7 +506,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -516,7 +516,7 @@ "404": { "description": "The country or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -526,7 +526,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -536,7 +536,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -571,7 +571,7 @@ "404": { "description": "The country does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -635,7 +635,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/languageCollectionResponseDocument" } @@ -657,7 +657,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -667,7 +667,7 @@ "404": { "description": "The country does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -813,7 +813,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/languageIdentifierCollectionResponseDocument" } @@ -835,7 +835,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -845,7 +845,7 @@ "404": { "description": "The country does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -958,7 +958,7 @@ "requestBody": { "description": "The identities of the languages to add to the languages relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -977,7 +977,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -987,7 +987,7 @@ "404": { "description": "The country or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -997,7 +997,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1007,7 +1007,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1038,7 +1038,7 @@ "requestBody": { "description": "The identities of the languages to assign to the languages relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1057,7 +1057,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1067,7 +1067,7 @@ "404": { "description": "The country or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1077,7 +1077,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1087,7 +1087,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1118,7 +1118,7 @@ "requestBody": { "description": "The identities of the languages to remove from the languages relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1137,7 +1137,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1147,7 +1147,7 @@ "404": { "description": "The country or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1157,7 +1157,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1167,7 +1167,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1180,47 +1180,161 @@ }, "components": { "schemas": { + "attributesInCountryResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "population": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "attributesInCreateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "population": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { "required": [ - "name" + "openapi:discriminator" ], "type": "object", "properties": { - "name": { - "type": "string" - }, - "population": { - "type": "integer", - "format": "int64" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/attributesInCreateCountryRequest" } }, + "x-abstract": true + }, + "attributesInLanguageResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "attributesInUpdateCountryRequest": { + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "name": { - "type": "string" - }, - "population": { - "type": "integer", - "format": "int64" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/attributesInCountryResponse", + "languages": "#/components/schemas/attributesInLanguageResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "population": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "countryAttributesInResponse": { + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "name": { - "type": "string" - }, - "population": { - "type": "integer", - "format": "int64" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/attributesInUpdateCountryRequest" + } + }, + "x-abstract": true }, "countryCollectionResponseDocument": { "required": [ @@ -1239,13 +1353,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/countryDataInResponse" + "$ref": "#/components/schemas/dataInCountryResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -1258,10 +1372,33 @@ }, "additionalProperties": false }, - "countryDataInResponse": { + "createCountryRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateCountryRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCountryResponse": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" }, { "required": [ @@ -1277,14 +1414,14 @@ "attributes": { "allOf": [ { - "$ref": "#/components/schemas/countryAttributesInResponse" + "$ref": "#/components/schemas/attributesInCountryResponse" } ] }, "relationships": { "allOf": [ { - "$ref": "#/components/schemas/countryRelationshipsInResponse" + "$ref": "#/components/schemas/relationshipsInCountryResponse" } ] }, @@ -1301,194 +1438,106 @@ ], "additionalProperties": false }, - "countryPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], + "dataInCreateCountryRequest": { "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/countryDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "countryRelationshipsInResponse": { - "type": "object", - "properties": { - "languages": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyLanguageInResponse" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateCountryRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateCountryRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, - "additionalProperties": false - }, - "countryResourceType": { - "enum": [ - "countries" ], - "type": "string" - }, - "createCountryRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateCountryRequest" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, "additionalProperties": false }, - "dataInCreateCountryRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/countryResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateCountryRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateCountryRequest" - } - ] + "dataInLanguageResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInLanguageResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, - "additionalProperties": false - }, - "dataInResponse": { - "required": [ - "type" ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceType" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "countries": "#/components/schemas/countryDataInResponse", - "languages": "#/components/schemas/languageDataInResponse" - } - }, - "x-abstract": true + "additionalProperties": false }, "dataInUpdateCountryRequest": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/countryResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateCountryRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateCountryRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateCountryRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateCountryRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "errorLinks": { @@ -1613,17 +1662,35 @@ }, "additionalProperties": false }, - "languageAttributesInResponse": { + "identifierInRequest": { + "required": [ + "type" + ], "type": "object", "properties": { - "code": { - "type": "string" + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, - "name": { - "type": "string" + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "languages": "#/components/schemas/languageIdentifierInRequest" + } + }, + "x-abstract": true }, "languageCollectionResponseDocument": { "required": [ @@ -1642,59 +1709,23 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/languageDataInResponse" + "$ref": "#/components/schemas/dataInLanguageResponse" } }, "included": { "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "languageDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/languageAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" } - }, - "additionalProperties": false + ] } - ], + }, "additionalProperties": false }, "languageIdentifierCollectionResponseDocument": { @@ -1728,6 +1759,29 @@ "additionalProperties": false }, "languageIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "languageIdentifierInResponse": { "required": [ "id", "type" @@ -1756,24 +1810,44 @@ }, "additionalProperties": false }, - "languageIdentifierInResponse": { + "languageResourceType": { + "enum": [ + "languages" + ], + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "primaryCountryResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/languageResourceType" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCountryResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -1785,18 +1859,6 @@ }, "additionalProperties": false }, - "languageResourceType": { - "enum": [ - "languages" - ], - "type": "string" - }, - "meta": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, "relationshipLinks": { "type": "object", "properties": { @@ -1809,32 +1871,138 @@ }, "additionalProperties": false }, + "relationshipsInCountryResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "languages": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "relationshipsInCreateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "languages": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "languages": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyLanguageInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/relationshipsInCreateCountryRequest" + } + }, + "x-abstract": true }, - "relationshipsInUpdateCountryRequest": { + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "languages": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyLanguageInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/relationshipsInCountryResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "languages": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/relationshipsInUpdateCountryRequest" + } + }, + "x-abstract": true + }, "resourceCollectionTopLevelLinks": { "type": "object", "properties": { @@ -1886,6 +2054,97 @@ }, "additionalProperties": false }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "countries": "#/components/schemas/dataInCreateCountryRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "countries": "#/components/schemas/dataInCountryResponse", + "languages": "#/components/schemas/dataInLanguageResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "countries": "#/components/schemas/dataInUpdateCountryRequest" + } + }, + "x-abstract": true + }, "resourceLinks": { "type": "object", "properties": { diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json index e1643958dd..f72814347b 100644 --- a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/airplane-collection-response-document" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the airplane to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/airplane-primary-response-document" + "$ref": "#/components/schemas/primary-airplane-response-document" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -317,9 +317,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/airplane-primary-response-document" + "$ref": "#/components/schemas/primary-airplane-response-document" } } } @@ -339,7 +339,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -349,7 +349,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -471,7 +471,7 @@ "requestBody": { "description": "The attributes and relationships of the airplane to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -487,9 +487,9 @@ "200": { "description": "The airplane was successfully updated, which resulted in additional changes. The updated airplane is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/airplane-primary-response-document" + "$ref": "#/components/schemas/primary-airplane-response-document" } } } @@ -500,7 +500,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -510,7 +510,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -520,7 +520,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -530,7 +530,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -563,7 +563,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -625,7 +625,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -647,7 +647,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -657,7 +657,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -799,7 +799,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-identifier-collection-response-document" } @@ -821,7 +821,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -831,7 +831,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -940,7 +940,7 @@ "requestBody": { "description": "The identities of the flights to add to the flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -959,7 +959,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -969,7 +969,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -979,7 +979,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -989,7 +989,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1018,7 +1018,7 @@ "requestBody": { "description": "The identities of the flights to assign to the flights relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1037,7 +1037,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1047,7 +1047,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1057,7 +1057,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1067,7 +1067,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1096,7 +1096,7 @@ "requestBody": { "description": "The identities of the flights to remove from the flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1115,7 +1115,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1125,7 +1125,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1135,7 +1135,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1145,7 +1145,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1198,7 +1198,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-collection-response-document" } @@ -1220,7 +1220,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1321,7 +1321,7 @@ "requestBody": { "description": "The attributes and relationships of the flight-attendant to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1347,9 +1347,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-primary-response-document" + "$ref": "#/components/schemas/primary-flight-attendant-response-document" } } } @@ -1360,7 +1360,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1370,7 +1370,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1380,7 +1380,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1390,7 +1390,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1400,7 +1400,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1462,9 +1462,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-primary-response-document" + "$ref": "#/components/schemas/primary-flight-attendant-response-document" } } } @@ -1484,7 +1484,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1494,7 +1494,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1616,7 +1616,7 @@ "requestBody": { "description": "The attributes and relationships of the flight-attendant to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1632,9 +1632,9 @@ "200": { "description": "The flight-attendant was successfully updated, which resulted in additional changes. The updated flight-attendant is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-primary-response-document" + "$ref": "#/components/schemas/primary-flight-attendant-response-document" } } } @@ -1645,7 +1645,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1655,7 +1655,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1665,7 +1665,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1675,7 +1675,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1708,7 +1708,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1770,7 +1770,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -1792,7 +1792,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1802,7 +1802,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1944,7 +1944,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-identifier-collection-response-document" } @@ -1966,7 +1966,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1976,7 +1976,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2085,7 +2085,7 @@ "requestBody": { "description": "The identities of the flights to add to the purser-on-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2104,7 +2104,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2114,7 +2114,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2124,7 +2124,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2134,7 +2134,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2163,7 +2163,7 @@ "requestBody": { "description": "The identities of the flights to assign to the purser-on-flights relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2182,7 +2182,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2192,7 +2192,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2202,7 +2202,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2212,7 +2212,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2241,7 +2241,7 @@ "requestBody": { "description": "The identities of the flights to remove from the purser-on-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2260,7 +2260,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2270,7 +2270,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2280,7 +2280,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2290,7 +2290,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2352,7 +2352,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -2374,7 +2374,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2384,7 +2384,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2526,7 +2526,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-identifier-collection-response-document" } @@ -2548,7 +2548,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2558,7 +2558,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2667,7 +2667,7 @@ "requestBody": { "description": "The identities of the flights to add to the scheduled-for-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2686,7 +2686,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2696,7 +2696,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2706,7 +2706,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2716,7 +2716,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2745,7 +2745,7 @@ "requestBody": { "description": "The identities of the flights to assign to the scheduled-for-flights relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2764,7 +2764,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2774,7 +2774,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2784,7 +2784,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2794,7 +2794,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2823,7 +2823,7 @@ "requestBody": { "description": "The identities of the flights to remove from the scheduled-for-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2842,7 +2842,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2852,7 +2852,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2862,7 +2862,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2872,7 +2872,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2925,7 +2925,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -2947,7 +2947,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3048,7 +3048,7 @@ "requestBody": { "description": "The attributes and relationships of the flight to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3074,9 +3074,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-primary-response-document" + "$ref": "#/components/schemas/primary-flight-response-document" } } } @@ -3087,7 +3087,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3097,7 +3097,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3107,7 +3107,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3117,7 +3117,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3127,7 +3127,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3189,9 +3189,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-primary-response-document" + "$ref": "#/components/schemas/primary-flight-response-document" } } } @@ -3211,7 +3211,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3221,7 +3221,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3343,7 +3343,7 @@ "requestBody": { "description": "The attributes and relationships of the flight to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3359,9 +3359,9 @@ "200": { "description": "The flight was successfully updated, which resulted in additional changes. The updated flight is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-primary-response-document" + "$ref": "#/components/schemas/primary-flight-response-document" } } } @@ -3372,7 +3372,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3382,7 +3382,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3392,7 +3392,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3402,7 +3402,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3435,7 +3435,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3497,9 +3497,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullable-flight-attendant-secondary-response-document" + "$ref": "#/components/schemas/nullable-secondary-flight-attendant-response-document" } } } @@ -3519,7 +3519,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3529,7 +3529,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3671,7 +3671,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullable-flight-attendant-identifier-response-document" } @@ -3693,7 +3693,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3703,7 +3703,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3812,7 +3812,7 @@ "requestBody": { "description": "The identity of the flight-attendant to assign to the backup-purser relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3831,7 +3831,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3841,7 +3841,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3851,7 +3851,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3861,7 +3861,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3923,7 +3923,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-collection-response-document" } @@ -3945,7 +3945,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3955,7 +3955,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4097,7 +4097,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-identifier-collection-response-document" } @@ -4119,7 +4119,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4129,7 +4129,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4238,7 +4238,7 @@ "requestBody": { "description": "The identities of the flight-attendants to add to the cabin-crew-members relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4257,7 +4257,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4267,7 +4267,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4277,7 +4277,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4287,7 +4287,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4316,7 +4316,7 @@ "requestBody": { "description": "The identities of the flight-attendants to assign to the cabin-crew-members relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4335,7 +4335,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4345,7 +4345,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4355,7 +4355,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4365,7 +4365,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4394,7 +4394,7 @@ "requestBody": { "description": "The identities of the flight-attendants to remove from the cabin-crew-members relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4413,7 +4413,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4423,7 +4423,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4433,7 +4433,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4443,7 +4443,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4505,7 +4505,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/passenger-collection-response-document" } @@ -4527,7 +4527,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4537,7 +4537,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4679,7 +4679,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/passenger-identifier-collection-response-document" } @@ -4701,7 +4701,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4711,7 +4711,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4820,7 +4820,7 @@ "requestBody": { "description": "The identities of the passengers to add to the passengers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4839,7 +4839,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4849,7 +4849,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4859,7 +4859,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4869,7 +4869,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4898,7 +4898,7 @@ "requestBody": { "description": "The identities of the passengers to assign to the passengers relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4917,7 +4917,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4927,7 +4927,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4937,7 +4937,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4947,7 +4947,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4976,7 +4976,7 @@ "requestBody": { "description": "The identities of the passengers to remove from the passengers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4995,7 +4995,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5005,7 +5005,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5015,7 +5015,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5025,7 +5025,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5087,9 +5087,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-secondary-response-document" + "$ref": "#/components/schemas/secondary-flight-attendant-response-document" } } } @@ -5109,7 +5109,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5119,7 +5119,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5261,7 +5261,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-identifier-response-document" } @@ -5283,7 +5283,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5293,7 +5293,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5402,7 +5402,7 @@ "requestBody": { "description": "The identity of the flight-attendant to assign to the purser relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -5421,7 +5421,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5431,7 +5431,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5441,7 +5441,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5451,7 +5451,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5504,7 +5504,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/passenger-collection-response-document" } @@ -5526,7 +5526,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5627,7 +5627,7 @@ "requestBody": { "description": "The attributes and relationships of the passenger to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -5653,9 +5653,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/passenger-primary-response-document" + "$ref": "#/components/schemas/primary-passenger-response-document" } } } @@ -5666,7 +5666,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5676,7 +5676,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5686,7 +5686,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5696,7 +5696,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5706,7 +5706,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5768,9 +5768,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/passenger-primary-response-document" + "$ref": "#/components/schemas/primary-passenger-response-document" } } } @@ -5790,7 +5790,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5800,7 +5800,7 @@ "404": { "description": "The passenger does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5922,7 +5922,7 @@ "requestBody": { "description": "The attributes and relationships of the passenger to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -5938,9 +5938,9 @@ "200": { "description": "The passenger was successfully updated, which resulted in additional changes. The updated passenger is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/passenger-primary-response-document" + "$ref": "#/components/schemas/primary-passenger-response-document" } } } @@ -5951,7 +5951,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5961,7 +5961,7 @@ "404": { "description": "The passenger or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5971,7 +5971,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5981,7 +5981,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -6014,7 +6014,7 @@ "404": { "description": "The passenger does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -6045,51 +6045,6 @@ "type": "string", "description": "Lists the various airlines used in this API." }, - "airplane-attributes-in-response": { - "type": "object", - "properties": { - "name": { - "maxLength": 255, - "type": "string" - }, - "serial-number": { - "maxLength": 16, - "type": "string", - "nullable": true - }, - "airtime-in-hours": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "last-serviced-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "manufactured-at": { - "type": "string", - "description": "Gets the day on which this airplane was manufactured.", - "format": "date-time" - }, - "is-in-maintenance": { - "type": "boolean" - }, - "manufactured-in-city": { - "maxLength": 85, - "type": "string", - "nullable": true - }, - "kind": { - "allOf": [ - { - "$ref": "#/components/schemas/aircraft-kind" - } - ] - } - }, - "additionalProperties": false - }, "airplane-collection-response-document": { "required": [ "data", @@ -6114,13 +6069,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/airplane-data-in-response" + "$ref": "#/components/schemas/data-in-airplane-response" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -6133,38 +6088,50 @@ }, "additionalProperties": false }, - "airplane-data-in-response": { + "attributes-in-airplane-response": { "allOf": [ { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/attributes-in-response" }, { - "required": [ - "id" - ], "type": "object", "properties": { - "id": { + "name": { + "maxLength": 255, "type": "string" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-attributes-in-response" - } - ] + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-relationships-in-response" - } - ] + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true }, - "links": { + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "manufactured-at": { + "type": "string", + "description": "Gets the day on which this airplane was manufactured.", + "format": "date-time" + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + }, + "kind": { "allOf": [ { - "$ref": "#/components/schemas/resource-links" + "$ref": "#/components/schemas/aircraft-kind" } ] } @@ -6174,216 +6141,390 @@ ], "additionalProperties": false }, - "airplane-primary-response-document": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] + "attributes-in-create-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-data-in-response" + { + "required": [ + "email-address", + "profile-image-url" + ], + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "document-number" + ], + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "airplane-relationships-in-response": { + "attributes-in-create-request": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "flights": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-flight-in-response" + "$ref": "#/components/schemas/resource-type" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-create-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-create-flight-attendant-request", + "passengers": "#/components/schemas/attributes-in-create-passenger-request" + } + }, + "x-abstract": true }, - "airplane-resource-type": { - "enum": [ - "airplanes" + "attributes-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" + }, + "distance-traveled-in-kilometers": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } ], - "type": "string" + "additionalProperties": false }, - "attributes-in-create-airplane-request": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "maxLength": 255, - "type": "string" - }, - "serial-number": { - "maxLength": 16, - "type": "string", - "nullable": true - }, - "airtime-in-hours": { - "type": "integer", - "format": "int32", - "nullable": true + "attributes-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" }, - "last-serviced-at": { - "type": "string", - "format": "date-time", - "nullable": true + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] + }, + "departs-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "arrives-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "services-on-board": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributes-in-create-flight-attendant-request": { - "required": [ - "email-address", - "profile-image-url" - ], - "type": "object", - "properties": { - "email-address": { - "minLength": 1, - "type": "string", - "format": "email" - }, - "age": { - "maximum": 75, - "minimum": 18, - "type": "integer", - "format": "int32" + "attributes-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" }, - "profile-image-url": { - "type": "string", - "format": "uri" + { + "type": "object", + "properties": { + "full-name": { + "type": "string", + "nullable": true + }, + "cabin-area": { + "allOf": [ + { + "$ref": "#/components/schemas/cabin-area" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributes-in-create-passenger-request": { + "attributes-in-response": { "required": [ - "document-number" + "openapi:discriminator" ], "type": "object", "properties": { - "document-number": { - "maxLength": 9, - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-airplane-response", + "flight-attendants": "#/components/schemas/attributes-in-flight-attendant-response", + "flights": "#/components/schemas/attributes-in-flight-response", + "passengers": "#/components/schemas/attributes-in-passenger-response" + } + }, + "x-abstract": true }, "attributes-in-update-airplane-request": { - "type": "object", - "properties": { - "name": { - "maxLength": 255, - "type": "string" - }, - "serial-number": { - "maxLength": 16, - "type": "string", - "nullable": true + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" }, - "airtime-in-hours": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "last-serviced-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "is-in-maintenance": { - "type": "boolean" - }, - "manufactured-in-city": { - "maxLength": 85, - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributes-in-update-flight-attendant-request": { - "type": "object", - "properties": { - "email-address": { - "minLength": 1, - "type": "string", - "format": "email" + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" }, - "age": { - "maximum": 75, - "minimum": 18, - "type": "integer", - "format": "int32" + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributes-in-update-flight-request": { - "type": "object", - "properties": { - "final-destination": { - "maxLength": 40, - "type": "string" - }, - "stop-over-destination": { - "maxLength": 2000, - "type": "string", - "nullable": true + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" }, - "operated-by": { - "allOf": [ - { - "$ref": "#/components/schemas/airline" + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributes-in-update-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-request": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "document-number": { - "maxLength": 9, - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-update-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-update-flight-attendant-request", + "flights": "#/components/schemas/attributes-in-update-flight-request", + "passengers": "#/components/schemas/attributes-in-update-passenger-request" + } + }, + "x-abstract": true }, "cabin-area": { "enum": [ @@ -6485,328 +6626,396 @@ }, "additionalProperties": false }, - "data-in-create-airplane-request": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-resource-type" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-airplane-request" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-create-airplane-request" - } - ] + "data-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-airplane-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-airplane-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-create-flight-attendant-request": { - "required": [ - "type" - ], + "data-in-create-airplane-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-resource-type" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-flight-attendant-request" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-airplane-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-create-flight-request": { - "required": [ - "type" - ], + "data-in-create-flight-attendant-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-resource-type" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-create-flight-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-create-passenger-request": { - "required": [ - "type" - ], + "data-in-create-flight-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/passenger-resource-type" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-passenger-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-response": { - "required": [ - "type" - ], + "data-in-create-passenger-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-type" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-passenger-request" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "airplanes": "#/components/schemas/airplane-data-in-response", - "flight-attendants": "#/components/schemas/flight-attendant-data-in-response", - "flights": "#/components/schemas/flight-data-in-response", - "passengers": "#/components/schemas/passenger-data-in-response" + }, + "additionalProperties": false } - }, - "x-abstract": true - }, - "data-in-update-airplane-request": { - "required": [ - "id", - "type" ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-resource-type" - } - ] - }, - "id": { - "type": "string" + "additionalProperties": false + }, + "data-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-airplane-request" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-attendant-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-attendant-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-update-airplane-request" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-passenger-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-update-flight-attendant-request": { - "required": [ - "id", - "type" - ], + "data-in-update-airplane-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-resource-type" - } - ] - }, - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-flight-attendant-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-airplane-request" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-flight-attendant-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "data-in-update-flight-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-resource-type" - } - ] - }, - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-flight-request" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-update-flight-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "data-in-update-passenger-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/passenger-resource-type" - } - ] - }, - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-passenger-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-passenger-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "error-links": { @@ -6938,31 +7147,6 @@ }, "additionalProperties": false }, - "flight-attendant-attributes-in-response": { - "type": "object", - "properties": { - "email-address": { - "minLength": 1, - "type": "string", - "format": "email" - }, - "age": { - "maximum": 75, - "minimum": 18, - "type": "integer", - "format": "int32" - }, - "profile-image-url": { - "type": "string", - "format": "uri" - }, - "distance-traveled-in-kilometers": { - "type": "integer", - "format": "int64" - } - }, - "additionalProperties": false - }, "flight-attendant-collection-response-document": { "required": [ "data", @@ -6987,13 +7171,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/flight-attendant-data-in-response" + "$ref": "#/components/schemas/data-in-flight-attendant-response" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7006,47 +7190,6 @@ }, "additionalProperties": false }, - "flight-attendant-data-in-response": { - "allOf": [ - { - "$ref": "#/components/schemas/data-in-response" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-attributes-in-response" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-relationships-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "flight-attendant-identifier-collection-response-document": { "required": [ "data", @@ -7085,30 +7228,24 @@ "additionalProperties": false }, "flight-attendant-identifier-in-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-resource-type" - } - ] - }, - "id": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "flight-attendant-identifier-in-response": { @@ -7176,158 +7313,12 @@ }, "additionalProperties": false }, - "flight-attendant-primary-response-document": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-data-in-response" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "flight-attendant-relationships-in-response": { - "type": "object", - "properties": { - "scheduled-for-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-response" - } - ] - }, - "purser-on-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-response" - } - ] - } - }, - "additionalProperties": false - }, "flight-attendant-resource-type": { "enum": [ "flight-attendants" ], "type": "string" }, - "flight-attendant-secondary-response-document": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-data-in-response" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "flight-attributes-in-response": { - "type": "object", - "properties": { - "final-destination": { - "maxLength": 40, - "type": "string" - }, - "stop-over-destination": { - "maxLength": 2000, - "type": "string", - "nullable": true - }, - "operated-by": { - "allOf": [ - { - "$ref": "#/components/schemas/airline" - } - ] - }, - "departs-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "arrives-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "services-on-board": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, "flight-collection-response-document": { "required": [ "data", @@ -7352,13 +7343,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/flight-data-in-response" + "$ref": "#/components/schemas/data-in-flight-response" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7371,47 +7362,6 @@ }, "additionalProperties": false }, - "flight-data-in-response": { - "allOf": [ - { - "$ref": "#/components/schemas/data-in-response" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attributes-in-response" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-relationships-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "flight-identifier-collection-response-document": { "required": [ "data", @@ -7450,30 +7400,24 @@ "additionalProperties": false }, "flight-identifier-in-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-resource-type" - } - ] - }, - "id": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "flight-identifier-in-response": { @@ -7503,40 +7447,25 @@ }, "additionalProperties": false }, - "flight-primary-response-document": { + "flight-resource-type": { + "enum": [ + "flights" + ], + "type": "string" + }, + "identifier-in-request": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" - } - ] - }, - "data": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/flight-data-in-response" + "$ref": "#/components/schemas/resource-type" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, "meta": { "allOf": [ { @@ -7545,47 +7474,16 @@ ] } }, - "additionalProperties": false - }, - "flight-relationships-in-response": { - "type": "object", - "properties": { - "cabin-crew-members": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-attendant-in-response" - } - ] - }, - "purser": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-flight-attendant-in-response" - } - ] - }, - "backup-purser": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-response" - } - ] - }, - "passengers": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-passenger-in-response" - } - ] + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "flight-attendants": "#/components/schemas/flight-attendant-identifier-in-request", + "flights": "#/components/schemas/flight-identifier-in-request", + "passengers": "#/components/schemas/passenger-identifier-in-request" } }, - "additionalProperties": false - }, - "flight-resource-type": { - "enum": [ - "flights" - ], - "type": "string" + "x-abstract": true }, "jsonapi": { "type": "object", @@ -7660,7 +7558,7 @@ }, "additionalProperties": false }, - "nullable-flight-attendant-secondary-response-document": { + "nullable-secondary-flight-attendant-response-document": { "required": [ "data", "links" @@ -7684,7 +7582,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/flight-attendant-data-in-response" + "$ref": "#/components/schemas/data-in-flight-attendant-response" } ], "nullable": true @@ -7692,7 +7590,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7757,24 +7655,141 @@ }, "additionalProperties": false }, - "passenger-attributes-in-response": { + "passenger-collection-response-document": { + "required": [ + "data", + "links" + ], "type": "object", "properties": { - "full-name": { - "type": "string", - "nullable": true + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-passenger-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "passenger-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/passenger-resource-type" + } + ] + }, + "id": { + "type": "string" }, - "cabin-area": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/cabin-area" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false }, - "passenger-collection-response-document": { + "passenger-resource-type": { + "enum": [ + "passengers" + ], + "type": "string" + }, + "primary-airplane-response-document": { "required": [ "data", "links" @@ -7791,20 +7806,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-collection-top-level-links" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/passenger-data-in-response" - } + "allOf": [ + { + "$ref": "#/components/schemas/data-in-airplane-response" + } + ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7817,41 +7833,7 @@ }, "additionalProperties": false }, - "passenger-data-in-response": { - "allOf": [ - { - "$ref": "#/components/schemas/data-in-response" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/passenger-attributes-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, - "passenger-identifier-collection-response-document": { + "primary-flight-attendant-response-document": { "required": [ "data", "links" @@ -7868,14 +7850,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { "type": "array", "items": { - "$ref": "#/components/schemas/passenger-identifier-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7888,49 +7877,39 @@ }, "additionalProperties": false }, - "passenger-identifier-in-request": { + "primary-flight-response-document": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "jsonapi": { "allOf": [ { - "$ref": "#/components/schemas/passenger-resource-type" + "$ref": "#/components/schemas/jsonapi" } ] }, - "id": { - "type": "string" - }, - "meta": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resource-top-level-links" } ] - } - }, - "additionalProperties": false - }, - "passenger-identifier-in-response": { - "required": [ - "id", - "type" - ], - "type": "object", - "properties": { - "type": { + }, + "data": { "allOf": [ { - "$ref": "#/components/schemas/passenger-resource-type" + "$ref": "#/components/schemas/data-in-flight-response" } ] }, - "id": { - "type": "string" + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } }, "meta": { "allOf": [ @@ -7942,7 +7921,7 @@ }, "additionalProperties": false }, - "passenger-primary-response-document": { + "primary-passenger-response-document": { "required": [ "data", "links" @@ -7966,14 +7945,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/passenger-data-in-response" + "$ref": "#/components/schemas/data-in-passenger-response" } ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7986,12 +7965,6 @@ }, "additionalProperties": false }, - "passenger-resource-type": { - "enum": [ - "passengers" - ], - "type": "string" - }, "relationship-links": { "type": "object", "properties": { @@ -8004,142 +7977,356 @@ }, "additionalProperties": false }, + "relationships-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "relationships-in-create-airplane-request": { - "type": "object", - "properties": { - "flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationships-in-create-flight-attendant-request": { - "type": "object", - "properties": { - "scheduled-for-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" }, - "purser-on-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationships-in-create-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "required": [ + "purser" + ], + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-request": { "required": [ - "purser" + "openapi:discriminator" ], "type": "object", "properties": { - "cabin-crew-members": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-flight-attendant-in-request" - } - ] - }, - "purser": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + "$ref": "#/components/schemas/resource-type" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-create-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-create-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-create-flight-request" + } + }, + "x-abstract": true + }, + "relationships-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" }, - "backup-purser": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" }, - "passengers": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-passenger-in-request" + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-response" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-response" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-response" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-response" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationships-in-update-airplane-request": { + "relationships-in-response": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "flights": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-flight-in-request" + "$ref": "#/components/schemas/resource-type" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-airplane-response", + "flight-attendants": "#/components/schemas/relationships-in-flight-attendant-response", + "flights": "#/components/schemas/relationships-in-flight-response" + } + }, + "x-abstract": true + }, + "relationships-in-update-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "relationships-in-update-flight-attendant-request": { - "type": "object", - "properties": { - "scheduled-for-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" }, - "purser-on-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationships-in-update-flight-request": { - "type": "object", - "properties": { - "cabin-crew-members": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-attendant-in-request" - } - ] - }, - "purser": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-flight-attendant-in-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" }, - "backup-purser": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] } - ] - }, - "passengers": { + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-passenger-in-request" + "$ref": "#/components/schemas/resource-type" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-update-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-update-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-update-flight-request" + } + }, + "x-abstract": true }, "resource-collection-top-level-links": { "type": "object", @@ -8207,6 +8394,105 @@ }, "additionalProperties": false }, + "resource-in-create-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-create-airplane-request", + "flight-attendants": "#/components/schemas/data-in-create-flight-attendant-request", + "flights": "#/components/schemas/data-in-create-flight-request", + "passengers": "#/components/schemas/data-in-create-passenger-request" + } + }, + "x-abstract": true + }, + "resource-in-response": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-airplane-response", + "flight-attendants": "#/components/schemas/data-in-flight-attendant-response", + "flights": "#/components/schemas/data-in-flight-response", + "passengers": "#/components/schemas/data-in-passenger-response" + } + }, + "x-abstract": true + }, + "resource-in-update-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-update-airplane-request", + "flight-attendants": "#/components/schemas/data-in-update-flight-attendant-request", + "flights": "#/components/schemas/data-in-update-flight-request", + "passengers": "#/components/schemas/data-in-update-passenger-request" + } + }, + "x-abstract": true + }, "resource-links": { "type": "object", "properties": { @@ -8237,6 +8523,50 @@ ], "type": "string" }, + "secondary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "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 e1643958dd..f72814347b 100644 --- a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json +++ b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/airplane-collection-response-document" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the airplane to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/airplane-primary-response-document" + "$ref": "#/components/schemas/primary-airplane-response-document" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -317,9 +317,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/airplane-primary-response-document" + "$ref": "#/components/schemas/primary-airplane-response-document" } } } @@ -339,7 +339,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -349,7 +349,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -471,7 +471,7 @@ "requestBody": { "description": "The attributes and relationships of the airplane to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -487,9 +487,9 @@ "200": { "description": "The airplane was successfully updated, which resulted in additional changes. The updated airplane is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/airplane-primary-response-document" + "$ref": "#/components/schemas/primary-airplane-response-document" } } } @@ -500,7 +500,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -510,7 +510,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -520,7 +520,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -530,7 +530,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -563,7 +563,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -625,7 +625,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -647,7 +647,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -657,7 +657,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -799,7 +799,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-identifier-collection-response-document" } @@ -821,7 +821,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -831,7 +831,7 @@ "404": { "description": "The airplane does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -940,7 +940,7 @@ "requestBody": { "description": "The identities of the flights to add to the flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -959,7 +959,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -969,7 +969,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -979,7 +979,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -989,7 +989,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1018,7 +1018,7 @@ "requestBody": { "description": "The identities of the flights to assign to the flights relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1037,7 +1037,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1047,7 +1047,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1057,7 +1057,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1067,7 +1067,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1096,7 +1096,7 @@ "requestBody": { "description": "The identities of the flights to remove from the flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1115,7 +1115,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1125,7 +1125,7 @@ "404": { "description": "The airplane or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1135,7 +1135,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1145,7 +1145,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1198,7 +1198,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-collection-response-document" } @@ -1220,7 +1220,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1321,7 +1321,7 @@ "requestBody": { "description": "The attributes and relationships of the flight-attendant to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1347,9 +1347,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-primary-response-document" + "$ref": "#/components/schemas/primary-flight-attendant-response-document" } } } @@ -1360,7 +1360,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1370,7 +1370,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1380,7 +1380,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1390,7 +1390,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1400,7 +1400,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1462,9 +1462,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-primary-response-document" + "$ref": "#/components/schemas/primary-flight-attendant-response-document" } } } @@ -1484,7 +1484,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1494,7 +1494,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1616,7 +1616,7 @@ "requestBody": { "description": "The attributes and relationships of the flight-attendant to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1632,9 +1632,9 @@ "200": { "description": "The flight-attendant was successfully updated, which resulted in additional changes. The updated flight-attendant is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-primary-response-document" + "$ref": "#/components/schemas/primary-flight-attendant-response-document" } } } @@ -1645,7 +1645,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1655,7 +1655,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1665,7 +1665,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1675,7 +1675,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1708,7 +1708,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1770,7 +1770,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -1792,7 +1792,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1802,7 +1802,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1944,7 +1944,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-identifier-collection-response-document" } @@ -1966,7 +1966,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1976,7 +1976,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2085,7 +2085,7 @@ "requestBody": { "description": "The identities of the flights to add to the purser-on-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2104,7 +2104,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2114,7 +2114,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2124,7 +2124,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2134,7 +2134,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2163,7 +2163,7 @@ "requestBody": { "description": "The identities of the flights to assign to the purser-on-flights relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2182,7 +2182,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2192,7 +2192,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2202,7 +2202,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2212,7 +2212,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2241,7 +2241,7 @@ "requestBody": { "description": "The identities of the flights to remove from the purser-on-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2260,7 +2260,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2270,7 +2270,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2280,7 +2280,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2290,7 +2290,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2352,7 +2352,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -2374,7 +2374,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2384,7 +2384,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2526,7 +2526,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-identifier-collection-response-document" } @@ -2548,7 +2548,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2558,7 +2558,7 @@ "404": { "description": "The flight-attendant does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2667,7 +2667,7 @@ "requestBody": { "description": "The identities of the flights to add to the scheduled-for-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2686,7 +2686,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2696,7 +2696,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2706,7 +2706,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2716,7 +2716,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2745,7 +2745,7 @@ "requestBody": { "description": "The identities of the flights to assign to the scheduled-for-flights relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2764,7 +2764,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2774,7 +2774,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2784,7 +2784,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2794,7 +2794,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2823,7 +2823,7 @@ "requestBody": { "description": "The identities of the flights to remove from the scheduled-for-flights relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2842,7 +2842,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2852,7 +2852,7 @@ "404": { "description": "The flight-attendant or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2862,7 +2862,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2872,7 +2872,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2925,7 +2925,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-collection-response-document" } @@ -2947,7 +2947,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3048,7 +3048,7 @@ "requestBody": { "description": "The attributes and relationships of the flight to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3074,9 +3074,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-primary-response-document" + "$ref": "#/components/schemas/primary-flight-response-document" } } } @@ -3087,7 +3087,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3097,7 +3097,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3107,7 +3107,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3117,7 +3117,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3127,7 +3127,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3189,9 +3189,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-primary-response-document" + "$ref": "#/components/schemas/primary-flight-response-document" } } } @@ -3211,7 +3211,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3221,7 +3221,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3343,7 +3343,7 @@ "requestBody": { "description": "The attributes and relationships of the flight to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3359,9 +3359,9 @@ "200": { "description": "The flight was successfully updated, which resulted in additional changes. The updated flight is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-primary-response-document" + "$ref": "#/components/schemas/primary-flight-response-document" } } } @@ -3372,7 +3372,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3382,7 +3382,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3392,7 +3392,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3402,7 +3402,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3435,7 +3435,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3497,9 +3497,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullable-flight-attendant-secondary-response-document" + "$ref": "#/components/schemas/nullable-secondary-flight-attendant-response-document" } } } @@ -3519,7 +3519,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3529,7 +3529,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3671,7 +3671,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullable-flight-attendant-identifier-response-document" } @@ -3693,7 +3693,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3703,7 +3703,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3812,7 +3812,7 @@ "requestBody": { "description": "The identity of the flight-attendant to assign to the backup-purser relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3831,7 +3831,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3841,7 +3841,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3851,7 +3851,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3861,7 +3861,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3923,7 +3923,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-collection-response-document" } @@ -3945,7 +3945,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -3955,7 +3955,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4097,7 +4097,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-identifier-collection-response-document" } @@ -4119,7 +4119,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4129,7 +4129,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4238,7 +4238,7 @@ "requestBody": { "description": "The identities of the flight-attendants to add to the cabin-crew-members relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4257,7 +4257,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4267,7 +4267,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4277,7 +4277,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4287,7 +4287,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4316,7 +4316,7 @@ "requestBody": { "description": "The identities of the flight-attendants to assign to the cabin-crew-members relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4335,7 +4335,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4345,7 +4345,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4355,7 +4355,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4365,7 +4365,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4394,7 +4394,7 @@ "requestBody": { "description": "The identities of the flight-attendants to remove from the cabin-crew-members relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4413,7 +4413,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4423,7 +4423,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4433,7 +4433,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4443,7 +4443,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4505,7 +4505,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/passenger-collection-response-document" } @@ -4527,7 +4527,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4537,7 +4537,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4679,7 +4679,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/passenger-identifier-collection-response-document" } @@ -4701,7 +4701,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4711,7 +4711,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4820,7 +4820,7 @@ "requestBody": { "description": "The identities of the passengers to add to the passengers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4839,7 +4839,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4849,7 +4849,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4859,7 +4859,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4869,7 +4869,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4898,7 +4898,7 @@ "requestBody": { "description": "The identities of the passengers to assign to the passengers relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4917,7 +4917,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4927,7 +4927,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4937,7 +4937,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4947,7 +4947,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -4976,7 +4976,7 @@ "requestBody": { "description": "The identities of the passengers to remove from the passengers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4995,7 +4995,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5005,7 +5005,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5015,7 +5015,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5025,7 +5025,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5087,9 +5087,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/flight-attendant-secondary-response-document" + "$ref": "#/components/schemas/secondary-flight-attendant-response-document" } } } @@ -5109,7 +5109,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5119,7 +5119,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5261,7 +5261,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/flight-attendant-identifier-response-document" } @@ -5283,7 +5283,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5293,7 +5293,7 @@ "404": { "description": "The flight does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5402,7 +5402,7 @@ "requestBody": { "description": "The identity of the flight-attendant to assign to the purser relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -5421,7 +5421,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5431,7 +5431,7 @@ "404": { "description": "The flight or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5441,7 +5441,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5451,7 +5451,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5504,7 +5504,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/passenger-collection-response-document" } @@ -5526,7 +5526,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5627,7 +5627,7 @@ "requestBody": { "description": "The attributes and relationships of the passenger to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -5653,9 +5653,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/passenger-primary-response-document" + "$ref": "#/components/schemas/primary-passenger-response-document" } } } @@ -5666,7 +5666,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5676,7 +5676,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5686,7 +5686,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5696,7 +5696,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5706,7 +5706,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5768,9 +5768,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/passenger-primary-response-document" + "$ref": "#/components/schemas/primary-passenger-response-document" } } } @@ -5790,7 +5790,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5800,7 +5800,7 @@ "404": { "description": "The passenger does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5922,7 +5922,7 @@ "requestBody": { "description": "The attributes and relationships of the passenger to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -5938,9 +5938,9 @@ "200": { "description": "The passenger was successfully updated, which resulted in additional changes. The updated passenger is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/passenger-primary-response-document" + "$ref": "#/components/schemas/primary-passenger-response-document" } } } @@ -5951,7 +5951,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5961,7 +5961,7 @@ "404": { "description": "The passenger or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5971,7 +5971,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -5981,7 +5981,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -6014,7 +6014,7 @@ "404": { "description": "The passenger does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -6045,51 +6045,6 @@ "type": "string", "description": "Lists the various airlines used in this API." }, - "airplane-attributes-in-response": { - "type": "object", - "properties": { - "name": { - "maxLength": 255, - "type": "string" - }, - "serial-number": { - "maxLength": 16, - "type": "string", - "nullable": true - }, - "airtime-in-hours": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "last-serviced-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "manufactured-at": { - "type": "string", - "description": "Gets the day on which this airplane was manufactured.", - "format": "date-time" - }, - "is-in-maintenance": { - "type": "boolean" - }, - "manufactured-in-city": { - "maxLength": 85, - "type": "string", - "nullable": true - }, - "kind": { - "allOf": [ - { - "$ref": "#/components/schemas/aircraft-kind" - } - ] - } - }, - "additionalProperties": false - }, "airplane-collection-response-document": { "required": [ "data", @@ -6114,13 +6069,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/airplane-data-in-response" + "$ref": "#/components/schemas/data-in-airplane-response" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -6133,38 +6088,50 @@ }, "additionalProperties": false }, - "airplane-data-in-response": { + "attributes-in-airplane-response": { "allOf": [ { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/attributes-in-response" }, { - "required": [ - "id" - ], "type": "object", "properties": { - "id": { + "name": { + "maxLength": 255, "type": "string" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-attributes-in-response" - } - ] + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-relationships-in-response" - } - ] + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true }, - "links": { + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "manufactured-at": { + "type": "string", + "description": "Gets the day on which this airplane was manufactured.", + "format": "date-time" + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + }, + "kind": { "allOf": [ { - "$ref": "#/components/schemas/resource-links" + "$ref": "#/components/schemas/aircraft-kind" } ] } @@ -6174,216 +6141,390 @@ ], "additionalProperties": false }, - "airplane-primary-response-document": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] + "attributes-in-create-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-data-in-response" + { + "required": [ + "email-address", + "profile-image-url" + ], + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "document-number" + ], + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "airplane-relationships-in-response": { + "attributes-in-create-request": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "flights": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-flight-in-response" + "$ref": "#/components/schemas/resource-type" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-create-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-create-flight-attendant-request", + "passengers": "#/components/schemas/attributes-in-create-passenger-request" + } + }, + "x-abstract": true }, - "airplane-resource-type": { - "enum": [ - "airplanes" + "attributes-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" + }, + "distance-traveled-in-kilometers": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } ], - "type": "string" + "additionalProperties": false }, - "attributes-in-create-airplane-request": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "maxLength": 255, - "type": "string" - }, - "serial-number": { - "maxLength": 16, - "type": "string", - "nullable": true - }, - "airtime-in-hours": { - "type": "integer", - "format": "int32", - "nullable": true + "attributes-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" }, - "last-serviced-at": { - "type": "string", - "format": "date-time", - "nullable": true + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] + }, + "departs-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "arrives-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "services-on-board": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributes-in-create-flight-attendant-request": { - "required": [ - "email-address", - "profile-image-url" - ], - "type": "object", - "properties": { - "email-address": { - "minLength": 1, - "type": "string", - "format": "email" - }, - "age": { - "maximum": 75, - "minimum": 18, - "type": "integer", - "format": "int32" + "attributes-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" }, - "profile-image-url": { - "type": "string", - "format": "uri" + { + "type": "object", + "properties": { + "full-name": { + "type": "string", + "nullable": true + }, + "cabin-area": { + "allOf": [ + { + "$ref": "#/components/schemas/cabin-area" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributes-in-create-passenger-request": { + "attributes-in-response": { "required": [ - "document-number" + "openapi:discriminator" ], "type": "object", "properties": { - "document-number": { - "maxLength": 9, - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-airplane-response", + "flight-attendants": "#/components/schemas/attributes-in-flight-attendant-response", + "flights": "#/components/schemas/attributes-in-flight-response", + "passengers": "#/components/schemas/attributes-in-passenger-response" + } + }, + "x-abstract": true }, "attributes-in-update-airplane-request": { - "type": "object", - "properties": { - "name": { - "maxLength": 255, - "type": "string" - }, - "serial-number": { - "maxLength": 16, - "type": "string", - "nullable": true + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" }, - "airtime-in-hours": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "last-serviced-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "is-in-maintenance": { - "type": "boolean" - }, - "manufactured-in-city": { - "maxLength": 85, - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributes-in-update-flight-attendant-request": { - "type": "object", - "properties": { - "email-address": { - "minLength": 1, - "type": "string", - "format": "email" + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" }, - "age": { - "maximum": 75, - "minimum": 18, - "type": "integer", - "format": "int32" + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributes-in-update-flight-request": { - "type": "object", - "properties": { - "final-destination": { - "maxLength": 40, - "type": "string" - }, - "stop-over-destination": { - "maxLength": 2000, - "type": "string", - "nullable": true + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" }, - "operated-by": { - "allOf": [ - { - "$ref": "#/components/schemas/airline" + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributes-in-update-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-request": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "document-number": { - "maxLength": 9, - "type": "string" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-update-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-update-flight-attendant-request", + "flights": "#/components/schemas/attributes-in-update-flight-request", + "passengers": "#/components/schemas/attributes-in-update-passenger-request" + } + }, + "x-abstract": true }, "cabin-area": { "enum": [ @@ -6485,328 +6626,396 @@ }, "additionalProperties": false }, - "data-in-create-airplane-request": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-resource-type" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-airplane-request" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-create-airplane-request" - } - ] + "data-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-airplane-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-airplane-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-create-flight-attendant-request": { - "required": [ - "type" - ], + "data-in-create-airplane-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-resource-type" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-flight-attendant-request" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-airplane-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-create-flight-request": { - "required": [ - "type" - ], + "data-in-create-flight-attendant-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-resource-type" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-create-flight-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-create-passenger-request": { - "required": [ - "type" - ], + "data-in-create-flight-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/passenger-resource-type" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-passenger-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-response": { - "required": [ - "type" - ], + "data-in-create-passenger-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-type" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-passenger-request" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "airplanes": "#/components/schemas/airplane-data-in-response", - "flight-attendants": "#/components/schemas/flight-attendant-data-in-response", - "flights": "#/components/schemas/flight-data-in-response", - "passengers": "#/components/schemas/passenger-data-in-response" + }, + "additionalProperties": false } - }, - "x-abstract": true - }, - "data-in-update-airplane-request": { - "required": [ - "id", - "type" ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/airplane-resource-type" - } - ] - }, - "id": { - "type": "string" + "additionalProperties": false + }, + "data-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-airplane-request" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-attendant-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-attendant-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-update-airplane-request" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-passenger-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-update-flight-attendant-request": { - "required": [ - "id", - "type" - ], + "data-in-update-airplane-request": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-resource-type" - } - ] - }, - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-flight-attendant-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-airplane-request" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-flight-attendant-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "data-in-update-flight-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-resource-type" - } - ] - }, - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-flight-request" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-update-flight-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "data-in-update-passenger-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/passenger-resource-type" - } - ] - }, - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-passenger-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-passenger-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "error-links": { @@ -6938,31 +7147,6 @@ }, "additionalProperties": false }, - "flight-attendant-attributes-in-response": { - "type": "object", - "properties": { - "email-address": { - "minLength": 1, - "type": "string", - "format": "email" - }, - "age": { - "maximum": 75, - "minimum": 18, - "type": "integer", - "format": "int32" - }, - "profile-image-url": { - "type": "string", - "format": "uri" - }, - "distance-traveled-in-kilometers": { - "type": "integer", - "format": "int64" - } - }, - "additionalProperties": false - }, "flight-attendant-collection-response-document": { "required": [ "data", @@ -6987,13 +7171,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/flight-attendant-data-in-response" + "$ref": "#/components/schemas/data-in-flight-attendant-response" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7006,47 +7190,6 @@ }, "additionalProperties": false }, - "flight-attendant-data-in-response": { - "allOf": [ - { - "$ref": "#/components/schemas/data-in-response" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-attributes-in-response" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-relationships-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "flight-attendant-identifier-collection-response-document": { "required": [ "data", @@ -7085,30 +7228,24 @@ "additionalProperties": false }, "flight-attendant-identifier-in-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-resource-type" - } - ] - }, - "id": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "flight-attendant-identifier-in-response": { @@ -7176,158 +7313,12 @@ }, "additionalProperties": false }, - "flight-attendant-primary-response-document": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-data-in-response" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "flight-attendant-relationships-in-response": { - "type": "object", - "properties": { - "scheduled-for-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-response" - } - ] - }, - "purser-on-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-response" - } - ] - } - }, - "additionalProperties": false - }, "flight-attendant-resource-type": { "enum": [ "flight-attendants" ], "type": "string" }, - "flight-attendant-secondary-response-document": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attendant-data-in-response" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "flight-attributes-in-response": { - "type": "object", - "properties": { - "final-destination": { - "maxLength": 40, - "type": "string" - }, - "stop-over-destination": { - "maxLength": 2000, - "type": "string", - "nullable": true - }, - "operated-by": { - "allOf": [ - { - "$ref": "#/components/schemas/airline" - } - ] - }, - "departs-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "arrives-at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "services-on-board": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, "flight-collection-response-document": { "required": [ "data", @@ -7352,13 +7343,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/flight-data-in-response" + "$ref": "#/components/schemas/data-in-flight-response" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7371,47 +7362,6 @@ }, "additionalProperties": false }, - "flight-data-in-response": { - "allOf": [ - { - "$ref": "#/components/schemas/data-in-response" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-attributes-in-response" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-relationships-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "flight-identifier-collection-response-document": { "required": [ "data", @@ -7450,30 +7400,24 @@ "additionalProperties": false }, "flight-identifier-in-request": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/flight-resource-type" - } - ] - }, - "id": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "flight-identifier-in-response": { @@ -7503,40 +7447,25 @@ }, "additionalProperties": false }, - "flight-primary-response-document": { + "flight-resource-type": { + "enum": [ + "flights" + ], + "type": "string" + }, + "identifier-in-request": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" - } - ] - }, - "data": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/flight-data-in-response" + "$ref": "#/components/schemas/resource-type" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, "meta": { "allOf": [ { @@ -7545,47 +7474,16 @@ ] } }, - "additionalProperties": false - }, - "flight-relationships-in-response": { - "type": "object", - "properties": { - "cabin-crew-members": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-attendant-in-response" - } - ] - }, - "purser": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-flight-attendant-in-response" - } - ] - }, - "backup-purser": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-response" - } - ] - }, - "passengers": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-passenger-in-response" - } - ] + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "flight-attendants": "#/components/schemas/flight-attendant-identifier-in-request", + "flights": "#/components/schemas/flight-identifier-in-request", + "passengers": "#/components/schemas/passenger-identifier-in-request" } }, - "additionalProperties": false - }, - "flight-resource-type": { - "enum": [ - "flights" - ], - "type": "string" + "x-abstract": true }, "jsonapi": { "type": "object", @@ -7660,7 +7558,7 @@ }, "additionalProperties": false }, - "nullable-flight-attendant-secondary-response-document": { + "nullable-secondary-flight-attendant-response-document": { "required": [ "data", "links" @@ -7684,7 +7582,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/flight-attendant-data-in-response" + "$ref": "#/components/schemas/data-in-flight-attendant-response" } ], "nullable": true @@ -7692,7 +7590,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7757,24 +7655,141 @@ }, "additionalProperties": false }, - "passenger-attributes-in-response": { + "passenger-collection-response-document": { + "required": [ + "data", + "links" + ], "type": "object", "properties": { - "full-name": { - "type": "string", - "nullable": true + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-passenger-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "passenger-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/passenger-resource-type" + } + ] + }, + "id": { + "type": "string" }, - "cabin-area": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/cabin-area" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false }, - "passenger-collection-response-document": { + "passenger-resource-type": { + "enum": [ + "passengers" + ], + "type": "string" + }, + "primary-airplane-response-document": { "required": [ "data", "links" @@ -7791,20 +7806,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-collection-top-level-links" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/passenger-data-in-response" - } + "allOf": [ + { + "$ref": "#/components/schemas/data-in-airplane-response" + } + ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7817,41 +7833,7 @@ }, "additionalProperties": false }, - "passenger-data-in-response": { - "allOf": [ - { - "$ref": "#/components/schemas/data-in-response" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/passenger-attributes-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, - "passenger-identifier-collection-response-document": { + "primary-flight-attendant-response-document": { "required": [ "data", "links" @@ -7868,14 +7850,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { "type": "array", "items": { - "$ref": "#/components/schemas/passenger-identifier-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7888,49 +7877,39 @@ }, "additionalProperties": false }, - "passenger-identifier-in-request": { + "primary-flight-response-document": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "jsonapi": { "allOf": [ { - "$ref": "#/components/schemas/passenger-resource-type" + "$ref": "#/components/schemas/jsonapi" } ] }, - "id": { - "type": "string" - }, - "meta": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resource-top-level-links" } ] - } - }, - "additionalProperties": false - }, - "passenger-identifier-in-response": { - "required": [ - "id", - "type" - ], - "type": "object", - "properties": { - "type": { + }, + "data": { "allOf": [ { - "$ref": "#/components/schemas/passenger-resource-type" + "$ref": "#/components/schemas/data-in-flight-response" } ] }, - "id": { - "type": "string" + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } }, "meta": { "allOf": [ @@ -7942,7 +7921,7 @@ }, "additionalProperties": false }, - "passenger-primary-response-document": { + "primary-passenger-response-document": { "required": [ "data", "links" @@ -7966,14 +7945,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/passenger-data-in-response" + "$ref": "#/components/schemas/data-in-passenger-response" } ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -7986,12 +7965,6 @@ }, "additionalProperties": false }, - "passenger-resource-type": { - "enum": [ - "passengers" - ], - "type": "string" - }, "relationship-links": { "type": "object", "properties": { @@ -8004,142 +7977,356 @@ }, "additionalProperties": false }, + "relationships-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "relationships-in-create-airplane-request": { - "type": "object", - "properties": { - "flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationships-in-create-flight-attendant-request": { - "type": "object", - "properties": { - "scheduled-for-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" }, - "purser-on-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationships-in-create-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "required": [ + "purser" + ], + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-request": { "required": [ - "purser" + "openapi:discriminator" ], "type": "object", "properties": { - "cabin-crew-members": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-flight-attendant-in-request" - } - ] - }, - "purser": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + "$ref": "#/components/schemas/resource-type" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-create-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-create-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-create-flight-request" + } + }, + "x-abstract": true + }, + "relationships-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" }, - "backup-purser": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" }, - "passengers": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-passenger-in-request" + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-response" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-response" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-response" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-response" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationships-in-update-airplane-request": { + "relationships-in-response": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "flights": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-flight-in-request" + "$ref": "#/components/schemas/resource-type" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-airplane-response", + "flight-attendants": "#/components/schemas/relationships-in-flight-attendant-response", + "flights": "#/components/schemas/relationships-in-flight-response" + } + }, + "x-abstract": true + }, + "relationships-in-update-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "relationships-in-update-flight-attendant-request": { - "type": "object", - "properties": { - "scheduled-for-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" }, - "purser-on-flights": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-in-request" + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "relationships-in-update-flight-request": { - "type": "object", - "properties": { - "cabin-crew-members": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-flight-attendant-in-request" - } - ] - }, - "purser": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-flight-attendant-in-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" }, - "backup-purser": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] } - ] - }, - "passengers": { + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-passenger-in-request" + "$ref": "#/components/schemas/resource-type" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-update-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-update-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-update-flight-request" + } + }, + "x-abstract": true }, "resource-collection-top-level-links": { "type": "object", @@ -8207,6 +8394,105 @@ }, "additionalProperties": false }, + "resource-in-create-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-create-airplane-request", + "flight-attendants": "#/components/schemas/data-in-create-flight-attendant-request", + "flights": "#/components/schemas/data-in-create-flight-request", + "passengers": "#/components/schemas/data-in-create-passenger-request" + } + }, + "x-abstract": true + }, + "resource-in-response": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-airplane-response", + "flight-attendants": "#/components/schemas/data-in-flight-attendant-response", + "flights": "#/components/schemas/data-in-flight-response", + "passengers": "#/components/schemas/data-in-passenger-response" + } + }, + "x-abstract": true + }, + "resource-in-update-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-update-airplane-request", + "flight-attendants": "#/components/schemas/data-in-update-flight-attendant-request", + "flights": "#/components/schemas/data-in-update-flight-request", + "passengers": "#/components/schemas/data-in-update-passenger-request" + } + }, + "x-abstract": true + }, "resource-links": { "type": "object", "properties": { @@ -8237,6 +8523,50 @@ ], "type": "string" }, + "secondary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "to-many-flight-attendant-in-request": { "required": [ "data" diff --git a/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs index 9b9cb1816a..1551866d53 100644 --- a/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs +++ b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs @@ -70,12 +70,12 @@ public async Task Error_links_schema_is_visible() } [Theory] - [InlineData("accommodationPrimaryResponseDocument")] - [InlineData("accommodationSecondaryResponseDocument")] - [InlineData("excursionPrimaryResponseDocument")] - [InlineData("transportPrimaryResponseDocument")] - [InlineData("nullableTransportSecondaryResponseDocument")] - [InlineData("vacationPrimaryResponseDocument")] + [InlineData("primaryAccommodationResponseDocument")] + [InlineData("secondaryAccommodationResponseDocument")] + [InlineData("primaryExcursionResponseDocument")] + [InlineData("primaryTransportResponseDocument")] + [InlineData("nullableSecondaryTransportResponseDocument")] + [InlineData("primaryVacationResponseDocument")] [InlineData("accommodationCollectionResponseDocument")] [InlineData("excursionCollectionResponseDocument")] [InlineData("transportCollectionResponseDocument")] @@ -87,10 +87,10 @@ public async Task Error_links_schema_is_visible() [InlineData("toOneAccommodationInResponse")] [InlineData("toManyExcursionInResponse")] [InlineData("nullableToOneTransportInResponse")] - [InlineData("accommodationDataInResponse.allOf[1]")] - [InlineData("excursionDataInResponse.allOf[1]")] - [InlineData("transportDataInResponse.allOf[1]")] - [InlineData("vacationDataInResponse.allOf[1]")] + [InlineData("dataInAccommodationResponse.allOf[1]")] + [InlineData("dataInExcursionResponse.allOf[1]")] + [InlineData("dataInTransportResponse.allOf[1]")] + [InlineData("dataInVacationResponse.allOf[1]")] public async Task All_container_schemas_contain_no_link_property(string containerSchemaId) { // Act diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json index 3db474a261..b72c15aecb 100644 --- a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/accommodationCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the accommodation to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/accommodationPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryAccommodationResponseDocument" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -319,9 +319,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/accommodationPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryAccommodationResponseDocument" } } } @@ -341,7 +341,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -351,7 +351,7 @@ "404": { "description": "The accommodation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -477,7 +477,7 @@ "requestBody": { "description": "The attributes and relationships of the accommodation to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -493,9 +493,9 @@ "200": { "description": "The accommodation was successfully updated, which resulted in additional changes. The updated accommodation is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/accommodationPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryAccommodationResponseDocument" } } } @@ -506,7 +506,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -516,7 +516,7 @@ "404": { "description": "The accommodation or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -526,7 +526,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -536,7 +536,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -571,7 +571,7 @@ "404": { "description": "The accommodation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -624,7 +624,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/excursionCollectionResponseDocument" } @@ -646,7 +646,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -747,7 +747,7 @@ "requestBody": { "description": "The attributes and relationships of the excursion to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -773,9 +773,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/excursionPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryExcursionResponseDocument" } } } @@ -786,7 +786,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -796,7 +796,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -806,7 +806,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -816,7 +816,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -826,7 +826,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -890,9 +890,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/excursionPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryExcursionResponseDocument" } } } @@ -912,7 +912,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -922,7 +922,7 @@ "404": { "description": "The excursion does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1048,7 +1048,7 @@ "requestBody": { "description": "The attributes and relationships of the excursion to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1064,9 +1064,9 @@ "200": { "description": "The excursion was successfully updated, which resulted in additional changes. The updated excursion is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/excursionPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryExcursionResponseDocument" } } } @@ -1077,7 +1077,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1087,7 +1087,7 @@ "404": { "description": "The excursion or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1097,7 +1097,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1107,7 +1107,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1142,7 +1142,7 @@ "404": { "description": "The excursion does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1195,7 +1195,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/transportCollectionResponseDocument" } @@ -1217,7 +1217,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1318,7 +1318,7 @@ "requestBody": { "description": "The attributes and relationships of the transport to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1344,9 +1344,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/transportPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTransportResponseDocument" } } } @@ -1357,7 +1357,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1367,7 +1367,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1377,7 +1377,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1387,7 +1387,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1397,7 +1397,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1461,9 +1461,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/transportPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTransportResponseDocument" } } } @@ -1483,7 +1483,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1493,7 +1493,7 @@ "404": { "description": "The transport does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1619,7 +1619,7 @@ "requestBody": { "description": "The attributes and relationships of the transport to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1635,9 +1635,9 @@ "200": { "description": "The transport was successfully updated, which resulted in additional changes. The updated transport is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/transportPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryTransportResponseDocument" } } } @@ -1648,7 +1648,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1658,7 +1658,7 @@ "404": { "description": "The transport or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1668,7 +1668,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1678,7 +1678,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1713,7 +1713,7 @@ "404": { "description": "The transport does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1766,7 +1766,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/vacationCollectionResponseDocument" } @@ -1788,7 +1788,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1889,7 +1889,7 @@ "requestBody": { "description": "The attributes and relationships of the vacation to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1915,9 +1915,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/vacationPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryVacationResponseDocument" } } } @@ -1928,7 +1928,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1938,7 +1938,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1948,7 +1948,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1958,7 +1958,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1968,7 +1968,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2032,9 +2032,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/vacationPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryVacationResponseDocument" } } } @@ -2054,7 +2054,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2064,7 +2064,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2190,7 +2190,7 @@ "requestBody": { "description": "The attributes and relationships of the vacation to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2206,9 +2206,9 @@ "200": { "description": "The vacation was successfully updated, which resulted in additional changes. The updated vacation is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/vacationPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryVacationResponseDocument" } } } @@ -2219,7 +2219,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2229,7 +2229,7 @@ "404": { "description": "The vacation or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2239,7 +2239,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2249,7 +2249,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2284,7 +2284,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2348,9 +2348,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/accommodationSecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryAccommodationResponseDocument" } } } @@ -2370,7 +2370,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2380,7 +2380,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2526,7 +2526,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/accommodationIdentifierResponseDocument" } @@ -2548,7 +2548,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2558,7 +2558,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2671,7 +2671,7 @@ "requestBody": { "description": "The identity of the accommodation to assign to the accommodation relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2690,7 +2690,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2700,7 +2700,7 @@ "404": { "description": "The vacation or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2710,7 +2710,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2720,7 +2720,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2784,7 +2784,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/excursionCollectionResponseDocument" } @@ -2806,7 +2806,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2816,7 +2816,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2962,7 +2962,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/excursionIdentifierCollectionResponseDocument" } @@ -2984,7 +2984,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2994,7 +2994,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3107,7 +3107,7 @@ "requestBody": { "description": "The identities of the excursions to add to the excursions relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3126,7 +3126,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3136,7 +3136,7 @@ "404": { "description": "The vacation or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3146,7 +3146,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3156,7 +3156,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3187,7 +3187,7 @@ "requestBody": { "description": "The identities of the excursions to assign to the excursions relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3206,7 +3206,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3216,7 +3216,7 @@ "404": { "description": "The vacation or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3226,7 +3226,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3236,7 +3236,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3267,7 +3267,7 @@ "requestBody": { "description": "The identities of the excursions to remove from the excursions relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3286,7 +3286,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3296,7 +3296,7 @@ "404": { "description": "The vacation or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3306,7 +3306,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3316,7 +3316,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3380,9 +3380,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableTransportSecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryTransportResponseDocument" } } } @@ -3402,7 +3402,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3412,7 +3412,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3558,7 +3558,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableTransportIdentifierResponseDocument" } @@ -3580,7 +3580,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3590,7 +3590,7 @@ "404": { "description": "The vacation does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3703,7 +3703,7 @@ "requestBody": { "description": "The identity of the transport to assign to the transport relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3722,7 +3722,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3732,7 +3732,7 @@ "404": { "description": "The vacation or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3742,7 +3742,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3752,7 +3752,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3765,15 +3765,6 @@ }, "components": { "schemas": { - "accommodationAttributesInResponse": { - "type": "object", - "properties": { - "address": { - "type": "string" - } - }, - "additionalProperties": false - }, "accommodationCollectionResponseDocument": { "required": [ "data", @@ -3791,13 +3782,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/accommodationDataInResponse" + "$ref": "#/components/schemas/dataInAccommodationResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3810,10 +3801,11 @@ }, "additionalProperties": false }, - "accommodationDataInResponse": { + "accommodationIdentifierInRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { "required": [ @@ -3825,20 +3817,6 @@ "minLength": 1, "type": "string", "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/accommodationAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] } }, "additionalProperties": false @@ -3846,35 +3824,6 @@ ], "additionalProperties": false }, - "accommodationIdentifierInRequest": { - "required": [ - "id", - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/accommodationResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "accommodationIdentifierInResponse": { "required": [ "id", @@ -3935,376 +3884,370 @@ }, "additionalProperties": false }, - "accommodationPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/accommodationDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "accommodationResourceType": { "enum": [ "accommodations" ], "type": "string" }, - "accommodationSecondaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/accommodationDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + "attributesInAccommodationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "address": { + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributesInCreateAccommodationRequest": { - "required": [ - "address" - ], - "type": "object", - "properties": { - "address": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "address" + ], + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributesInCreateExcursionRequest": { - "required": [ - "description", - "occursAt" - ], - "type": "object", - "properties": { - "occursAt": { - "type": "string", - "format": "date-time" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "description": { - "type": "string" + { + "required": [ + "description", + "occursAt" + ], + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInCreateTransportRequest": { + "attributesInCreateRequest": { "required": [ - "durationInMinutes", - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/transportType" + "$ref": "#/components/schemas/resourceType" } ] - }, - "durationInMinutes": { - "type": "integer", - "format": "int32" } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "accommodations": "#/components/schemas/attributesInCreateAccommodationRequest", + "excursions": "#/components/schemas/attributesInCreateExcursionRequest", + "transports": "#/components/schemas/attributesInCreateTransportRequest", + "vacations": "#/components/schemas/attributesInCreateVacationRequest" + } + }, + "x-abstract": true }, - "attributesInCreateVacationRequest": { - "required": [ - "endsAt", - "startsAt" - ], - "type": "object", - "properties": { - "startsAt": { - "type": "string", - "format": "date-time" + "attributesInCreateTransportRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "endsAt": { - "type": "string", - "format": "date-time" + { + "required": [ + "durationInMinutes", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateAccommodationRequest": { - "type": "object", - "properties": { - "address": { - "type": "string" + "attributesInCreateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "endsAt", + "startsAt" + ], + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateExcursionRequest": { - "type": "object", - "properties": { - "occursAt": { - "type": "string", - "format": "date-time" + "attributesInExcursionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "description": { - "type": "string" + { + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateTransportRequest": { + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/transportType" + "$ref": "#/components/schemas/resourceType" } ] - }, - "durationInMinutes": { - "type": "integer", - "format": "int32" } }, - "additionalProperties": false - }, - "attributesInUpdateVacationRequest": { - "type": "object", - "properties": { - "startsAt": { - "type": "string", - "format": "date-time" - }, - "endsAt": { - "type": "string", - "format": "date-time" + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "accommodations": "#/components/schemas/attributesInAccommodationResponse", + "excursions": "#/components/schemas/attributesInExcursionResponse", + "transports": "#/components/schemas/attributesInTransportResponse", + "vacations": "#/components/schemas/attributesInVacationResponse" } }, - "additionalProperties": false + "x-abstract": true }, - "createAccommodationRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateAccommodationRequest" - } - ] + "attributesInTransportResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createExcursionRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateExcursionRequest" - } - ] + "attributesInUpdateAccommodationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "address": { + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createTransportRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateTransportRequest" - } - ] + "attributesInUpdateExcursionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createVacationRequestDocument": { + "attributesInUpdateRequest": { "required": [ - "data" + "openapi:discriminator" ], "type": "object", "properties": { - "data": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/dataInCreateVacationRequest" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "accommodations": "#/components/schemas/attributesInUpdateAccommodationRequest", + "excursions": "#/components/schemas/attributesInUpdateExcursionRequest", + "transports": "#/components/schemas/attributesInUpdateTransportRequest", + "vacations": "#/components/schemas/attributesInUpdateVacationRequest" + } + }, + "x-abstract": true }, - "dataInCreateAccommodationRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/accommodationResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateAccommodationRequest" - } - ] + "attributesInUpdateTransportRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateExcursionRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/excursionResourceType" - } - ] + "attributesInUpdateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateExcursionRequest" + { + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInVacationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateTransportRequest": { + "createAccommodationRequestDocument": { "required": [ - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/transportResourceType" - } - ] - }, - "attributes": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/attributesInCreateTransportRequest" + "$ref": "#/components/schemas/dataInCreateAccommodationRequest" } ] }, @@ -4318,30 +4261,16 @@ }, "additionalProperties": false }, - "dataInCreateVacationRequest": { + "createExcursionRequestDocument": { "required": [ - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/vacationResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateVacationRequest" - } - ] - }, - "relationships": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInCreateVacationRequest" + "$ref": "#/components/schemas/dataInCreateExcursionRequest" } ] }, @@ -4355,16 +4284,16 @@ }, "additionalProperties": false }, - "dataInResponse": { + "createTransportRequestDocument": { "required": [ - "type" + "data" ], "type": "object", "properties": { - "type": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/resourceType" + "$ref": "#/components/schemas/dataInCreateTransportRequest" } ] }, @@ -4376,41 +4305,18 @@ ] } }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "accommodations": "#/components/schemas/accommodationDataInResponse", - "excursions": "#/components/schemas/excursionDataInResponse", - "transports": "#/components/schemas/transportDataInResponse", - "vacations": "#/components/schemas/vacationDataInResponse" - } - }, - "x-abstract": true + "additionalProperties": false }, - "dataInUpdateAccommodationRequest": { + "createVacationRequestDocument": { "required": [ - "id", - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/accommodationResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/attributesInUpdateAccommodationRequest" + "$ref": "#/components/schemas/dataInCreateVacationRequest" } ] }, @@ -4424,119 +4330,377 @@ }, "additionalProperties": false }, - "dataInUpdateExcursionRequest": { - "required": [ - "id", - "type" + "dataInAccommodationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInAccommodationResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } ], + "additionalProperties": false + }, + "dataInCreateAccommodationRequest": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/excursionResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateExcursionRequest" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateAccommodationRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateExcursionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateExcursionRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInUpdateTransportRequest": { - "required": [ - "id", - "type" - ], + "dataInCreateTransportRequest": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/transportResourceType" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTransportRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateVacationRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateTransportRequest" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateVacationRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateVacationRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInExcursionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInExcursionResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInUpdateVacationRequest": { - "required": [ - "id", - "type" + "dataInTransportResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTransportResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } ], + "additionalProperties": false + }, + "dataInUpdateAccommodationRequest": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/vacationResourceType" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateAccommodationRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateExcursionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateExcursionRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateTransportRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateVacationRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTransportRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateVacationRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateVacationRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateVacationRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateVacationRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInVacationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInVacationResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInVacationResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "errorLinks": { @@ -4661,19 +4825,6 @@ }, "additionalProperties": false }, - "excursionAttributesInResponse": { - "type": "object", - "properties": { - "occursAt": { - "type": "string", - "format": "date-time" - }, - "description": { - "type": "string" - } - }, - "additionalProperties": false - }, "excursionCollectionResponseDocument": { "required": [ "data", @@ -4691,13 +4842,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/excursionDataInResponse" + "$ref": "#/components/schemas/dataInExcursionResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4710,42 +4861,6 @@ }, "additionalProperties": false }, - "excursionDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/excursionAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "excursionIdentifierCollectionResponseDocument": { "required": [ "data", @@ -4777,6 +4892,29 @@ "additionalProperties": false }, "excursionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "excursionIdentifierInResponse": { "required": [ "id", "type" @@ -4805,9 +4943,14 @@ }, "additionalProperties": false }, - "excursionIdentifierInResponse": { + "excursionResourceType": { + "enum": [ + "excursions" + ], + "type": "string" + }, + "identifierInRequest": { "required": [ - "id", "type" ], "type": "object", @@ -4815,15 +4958,10 @@ "type": { "allOf": [ { - "$ref": "#/components/schemas/excursionResourceType" + "$ref": "#/components/schemas/resourceType" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, "meta": { "allOf": [ { @@ -4832,9 +4970,24 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/accommodationIdentifierInRequest", + "excursions": "#/components/schemas/excursionIdentifierInRequest", + "transports": "#/components/schemas/transportIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } }, - "excursionPrimaryResponseDocument": { + "nullableSecondaryTransportResponseDocument": { "required": [ "data", "links" @@ -4851,14 +5004,15 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/excursionDataInResponse" + "$ref": "#/components/schemas/dataInTransportResponse" } - ] + ], + "nullable": true }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4871,31 +5025,116 @@ }, "additionalProperties": false }, - "excursionResourceType": { - "enum": [ - "excursions" + "nullableToOneTransportInRequest": { + "required": [ + "data" ], - "type": "string" + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false }, - "meta": { + "nullableToOneTransportInResponse": { "type": "object", - "additionalProperties": { - "nullable": true - } + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false }, - "nullableToOneTransportInRequest": { + "nullableTransportIdentifierResponseDocument": { "required": [ - "data" + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryAccommodationResponseDocument": { + "required": [ + "data", + "links" ], "type": "object", "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, "data": { "allOf": [ { - "$ref": "#/components/schemas/transportIdentifierInRequest" + "$ref": "#/components/schemas/dataInAccommodationResponse" } - ], - "nullable": true + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -4907,23 +5146,32 @@ }, "additionalProperties": false }, - "nullableToOneTransportInResponse": { + "primaryExcursionResponseDocument": { + "required": [ + "data", + "links" + ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/relationshipLinks" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/transportIdentifierInResponse" + "$ref": "#/components/schemas/dataInExcursionResponse" } - ], - "nullable": true + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -4935,7 +5183,7 @@ }, "additionalProperties": false }, - "nullableTransportIdentifierResponseDocument": { + "primaryTransportResponseDocument": { "required": [ "data", "links" @@ -4945,17 +5193,22 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/transportIdentifierInResponse" + "$ref": "#/components/schemas/dataInTransportResponse" } - ], - "nullable": true + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -4967,7 +5220,7 @@ }, "additionalProperties": false }, - "nullableTransportSecondaryResponseDocument": { + "primaryVacationResponseDocument": { "required": [ "data", "links" @@ -4984,15 +5237,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/transportDataInResponse" + "$ref": "#/components/schemas/dataInVacationResponse" } - ], - "nullable": true + ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -5017,61 +5269,181 @@ }, "additionalProperties": false }, - "relationshipsInCreateVacationRequest": { + "relationshipsInCreateRequest": { "required": [ - "accommodation" + "openapi:discriminator" ], "type": "object", "properties": { - "accommodation": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneAccommodationInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "vacations": "#/components/schemas/relationshipsInCreateVacationRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "transport": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneTransportInRequest" + { + "required": [ + "accommodation" + ], + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] } - ] - }, - "excursions": { + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyExcursionInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "vacations": "#/components/schemas/relationshipsInVacationResponse" + } + }, + "x-abstract": true }, - "relationshipsInUpdateVacationRequest": { + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "accommodation": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneAccommodationInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "vacations": "#/components/schemas/relationshipsInUpdateVacationRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "transport": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneTransportInRequest" + { + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInVacationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "excursions": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyExcursionInRequest" + { + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInResponse" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInResponse" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInResponse" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "resourceCollectionTopLevelLinks": { @@ -5123,22 +5495,121 @@ "type": "string" } }, - "additionalProperties": false - }, - "resourceIdentifierTopLevelLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "related": { - "type": "string" - }, - "describedby": { - "type": "string" + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/dataInCreateAccommodationRequest", + "excursions": "#/components/schemas/dataInCreateExcursionRequest", + "transports": "#/components/schemas/dataInCreateTransportRequest", + "vacations": "#/components/schemas/dataInCreateVacationRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/dataInAccommodationResponse", + "excursions": "#/components/schemas/dataInExcursionResponse", + "transports": "#/components/schemas/dataInTransportResponse", + "vacations": "#/components/schemas/dataInVacationResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/dataInUpdateAccommodationRequest", + "excursions": "#/components/schemas/dataInUpdateExcursionRequest", + "transports": "#/components/schemas/dataInUpdateTransportRequest", + "vacations": "#/components/schemas/dataInUpdateVacationRequest" } }, - "additionalProperties": false + "x-abstract": true }, "resourceLinks": { "type": "object", @@ -5170,6 +5641,43 @@ ], "type": "string" }, + "secondaryAccommodationResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInAccommodationResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "toManyExcursionInRequest": { "required": [ "data" @@ -5268,23 +5776,6 @@ }, "additionalProperties": false }, - "transportAttributesInResponse": { - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/transportType" - } - ] - }, - "durationInMinutes": { - "type": "integer", - "format": "int32" - } - }, - "additionalProperties": false - }, "transportCollectionResponseDocument": { "required": [ "data", @@ -5302,13 +5793,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/transportDataInResponse" + "$ref": "#/components/schemas/dataInTransportResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -5321,10 +5812,11 @@ }, "additionalProperties": false }, - "transportDataInResponse": { + "transportIdentifierInRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { "required": [ @@ -5336,20 +5828,6 @@ "minLength": 1, "type": "string", "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/transportAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] } }, "additionalProperties": false @@ -5357,35 +5835,6 @@ ], "additionalProperties": false }, - "transportIdentifierInRequest": { - "required": [ - "id", - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/transportResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "transportIdentifierInResponse": { "required": [ "id", @@ -5415,43 +5864,6 @@ }, "additionalProperties": false }, - "transportPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/transportDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "transportResourceType": { "enum": [ "transports" @@ -5560,20 +5972,6 @@ }, "additionalProperties": false }, - "vacationAttributesInResponse": { - "type": "object", - "properties": { - "startsAt": { - "type": "string", - "format": "date-time" - }, - "endsAt": { - "type": "string", - "format": "date-time" - } - }, - "additionalProperties": false - }, "vacationCollectionResponseDocument": { "required": [ "data", @@ -5591,93 +5989,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/vacationDataInResponse" - } - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/dataInVacationResponse" } }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "vacationDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/vacationAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/vacationRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, - "vacationPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/vacationDataInResponse" - } - ] - }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -5689,39 +6007,6 @@ } }, "additionalProperties": false - }, - "vacationRelationshipsInResponse": { - "type": "object", - "properties": { - "accommodation": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneAccommodationInResponse" - } - ] - }, - "transport": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneTransportInResponse" - } - ] - }, - "excursions": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyExcursionInResponse" - } - ] - } - }, - "additionalProperties": false - }, - "vacationResourceType": { - "enum": [ - "vacations" - ], - "type": "string" } } } diff --git a/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs index b5291d6333..21b65d07dd 100644 --- a/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs +++ b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs @@ -54,12 +54,12 @@ public async Task All_configurable_link_schemas_are_exposed(string schemaId, Lin } [Theory] - [InlineData("resourceTopLevelLinks", "accommodationPrimaryResponseDocument", true)] - [InlineData("resourceTopLevelLinks", "accommodationSecondaryResponseDocument", true)] - [InlineData("resourceTopLevelLinks", "excursionPrimaryResponseDocument", true)] - [InlineData("resourceTopLevelLinks", "transportPrimaryResponseDocument", true)] - [InlineData("resourceTopLevelLinks", "nullableTransportSecondaryResponseDocument", true)] - [InlineData("resourceTopLevelLinks", "vacationPrimaryResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "primaryAccommodationResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "secondaryAccommodationResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "primaryExcursionResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "primaryTransportResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "nullableSecondaryTransportResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "primaryVacationResponseDocument", true)] [InlineData("resourceCollectionTopLevelLinks", "accommodationCollectionResponseDocument", true)] [InlineData("resourceCollectionTopLevelLinks", "excursionCollectionResponseDocument", true)] [InlineData("resourceCollectionTopLevelLinks", "transportCollectionResponseDocument", true)] @@ -71,10 +71,10 @@ public async Task All_configurable_link_schemas_are_exposed(string schemaId, Lin [InlineData("relationshipLinks", "toOneAccommodationInResponse", false)] [InlineData("relationshipLinks", "toManyExcursionInResponse", false)] [InlineData("relationshipLinks", "nullableToOneTransportInResponse", false)] - [InlineData("resourceLinks", "accommodationDataInResponse.allOf[1]", false)] - [InlineData("resourceLinks", "excursionDataInResponse.allOf[1]", false)] - [InlineData("resourceLinks", "transportDataInResponse.allOf[1]", false)] - [InlineData("resourceLinks", "vacationDataInResponse.allOf[1]", false)] + [InlineData("resourceLinks", "dataInAccommodationResponse.allOf[1]", false)] + [InlineData("resourceLinks", "dataInExcursionResponse.allOf[1]", false)] + [InlineData("resourceLinks", "dataInTransportResponse.allOf[1]", false)] + [InlineData("resourceLinks", "dataInVacationResponse.allOf[1]", false)] public async Task All_container_schemas_contain_correct_link_property(string linkSchemaId, string containerSchemaId, bool isRequired) { // Act diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/swagger.g.json index dc36360d10..05a83c87ee 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/swagger.g.json @@ -35,7 +35,7 @@ "requestBody": { "description": "The attributes and relationships of the socialMediaAccount to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -61,9 +61,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/socialMediaAccountPrimaryResponseDocument" + "$ref": "#/components/schemas/primarySocialMediaAccountResponseDocument" } } } @@ -74,7 +74,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -84,7 +84,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -94,7 +94,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -104,7 +104,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -114,7 +114,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -160,7 +160,7 @@ "requestBody": { "description": "The attributes and relationships of the socialMediaAccount to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -176,9 +176,9 @@ "200": { "description": "The socialMediaAccount was successfully updated, which resulted in additional changes. The updated socialMediaAccount is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/socialMediaAccountPrimaryResponseDocument" + "$ref": "#/components/schemas/primarySocialMediaAccountResponseDocument" } } } @@ -189,7 +189,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -199,7 +199,7 @@ "404": { "description": "The socialMediaAccount or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -209,7 +209,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -219,7 +219,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -232,282 +232,427 @@ }, "components": { "schemas": { - "attributesInCreateSocialMediaAccountRequest": { + "attributesInCreateRequest": { "required": [ - "lastName" + "openapi:discriminator" ], "type": "object", "properties": { - "alternativeId": { - "type": "string", - "format": "uuid", - "nullable": true - }, - "firstName": { - "maxLength": 20, - "minLength": 2, - "type": "string", - "nullable": true - }, - "lastName": { - "type": "string" - }, - "userName": { - "maxLength": 18, - "minLength": 3, - "pattern": "^[a-zA-Z]+$", - "type": "string", - "nullable": true - }, - "creditCard": { - "type": "string", - "format": "credit-card", - "nullable": true - }, - "email": { - "type": "string", - "format": "email", - "nullable": true - }, - "password": { - "maxLength": 60, - "minLength": 20, - "type": "string", - "format": "byte", - "nullable": true - }, - "phone": { - "type": "string", - "format": "tel", - "nullable": true - }, - "age": { - "maximum": 122.9, - "exclusiveMaximum": true, - "minimum": 0.1, - "exclusiveMinimum": true, - "type": "number", - "format": "double", - "nullable": true - }, - "profilePicture": { - "type": "string", - "format": "uri", - "nullable": true - }, - "backgroundPicture": { - "type": "string", - "format": "uri", - "nullable": true - }, - "tags": { - "maxItems": 10, - "minItems": 1, - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "countryCode": { - "type": "string", - "nullable": true - }, - "planet": { - "type": "string", - "nullable": true - }, - "nextRevalidation": { - "type": "string", - "format": "date-span", - "nullable": true - }, - "validatedAt": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "validatedAtDate": { - "type": "string", - "format": "date", - "nullable": true - }, - "validatedAtTime": { - "type": "string", - "format": "time", - "nullable": true + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "socialMediaAccounts": "#/components/schemas/attributesInCreateSocialMediaAccountRequest" + } + }, + "x-abstract": true }, - "attributesInUpdateSocialMediaAccountRequest": { - "type": "object", - "properties": { - "alternativeId": { - "type": "string", - "format": "uuid", - "nullable": true - }, - "firstName": { - "maxLength": 20, - "minLength": 2, - "type": "string", - "nullable": true - }, - "lastName": { - "type": "string" - }, - "userName": { - "maxLength": 18, - "minLength": 3, - "pattern": "^[a-zA-Z]+$", - "type": "string", - "nullable": true - }, - "creditCard": { - "type": "string", - "format": "credit-card", - "nullable": true - }, - "email": { - "type": "string", - "format": "email", - "nullable": true - }, - "password": { - "maxLength": 60, - "minLength": 20, - "type": "string", - "format": "byte", - "nullable": true - }, - "phone": { - "type": "string", - "format": "tel", - "nullable": true - }, - "age": { - "maximum": 122.9, - "exclusiveMaximum": true, - "minimum": 0.1, - "exclusiveMinimum": true, - "type": "number", - "format": "double", - "nullable": true - }, - "profilePicture": { - "type": "string", - "format": "uri", - "nullable": true - }, - "backgroundPicture": { - "type": "string", - "format": "uri", - "nullable": true + "attributesInCreateSocialMediaAccountRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "tags": { - "maxItems": 10, - "minItems": 1, - "type": "array", - "items": { - "type": "string" + { + "required": [ + "lastName" + ], + "type": "object", + "properties": { + "alternativeId": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "firstName": { + "maxLength": 20, + "minLength": 2, + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "userName": { + "maxLength": 18, + "minLength": 3, + "pattern": "^[a-zA-Z]+$", + "type": "string", + "nullable": true + }, + "creditCard": { + "type": "string", + "format": "credit-card", + "nullable": true + }, + "email": { + "type": "string", + "format": "email", + "nullable": true + }, + "password": { + "maxLength": 60, + "minLength": 20, + "type": "string", + "format": "byte", + "nullable": true + }, + "phone": { + "type": "string", + "format": "tel", + "nullable": true + }, + "age": { + "maximum": 122.9, + "exclusiveMaximum": true, + "minimum": 0.1, + "exclusiveMinimum": true, + "type": "number", + "format": "double", + "nullable": true + }, + "profilePicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "backgroundPicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "tags": { + "maxItems": 10, + "minItems": 1, + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "countryCode": { + "type": "string", + "nullable": true + }, + "planet": { + "type": "string", + "nullable": true + }, + "nextRevalidation": { + "type": "string", + "format": "date-span", + "nullable": true + }, + "validatedAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "validatedAtDate": { + "type": "string", + "format": "date", + "nullable": true + }, + "validatedAtTime": { + "type": "string", + "format": "time", + "nullable": true + } }, - "nullable": true - }, - "countryCode": { - "type": "string", - "nullable": true - }, - "planet": { - "type": "string", - "nullable": true - }, - "nextRevalidation": { - "type": "string", - "format": "date-span", - "nullable": true - }, - "validatedAt": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "validatedAtDate": { - "type": "string", - "format": "date", - "nullable": true - }, - "validatedAtTime": { - "type": "string", - "format": "time", - "nullable": true + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createSocialMediaAccountRequestDocument": { + "attributesInResponse": { "required": [ - "data" + "openapi:discriminator" ], "type": "object", "properties": { - "data": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/dataInCreateSocialMediaAccountRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "socialMediaAccounts": "#/components/schemas/attributesInSocialMediaAccountResponse" + } + }, + "x-abstract": true + }, + "attributesInSocialMediaAccountResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "alternativeId": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "firstName": { + "maxLength": 20, + "minLength": 2, + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "userName": { + "maxLength": 18, + "minLength": 3, + "pattern": "^[a-zA-Z]+$", + "type": "string", + "nullable": true + }, + "creditCard": { + "type": "string", + "format": "credit-card", + "nullable": true + }, + "email": { + "type": "string", + "format": "email", + "nullable": true + }, + "password": { + "maxLength": 60, + "minLength": 20, + "type": "string", + "format": "byte", + "nullable": true + }, + "phone": { + "type": "string", + "format": "tel", + "nullable": true + }, + "age": { + "maximum": 122.9, + "exclusiveMaximum": true, + "minimum": 0.1, + "exclusiveMinimum": true, + "type": "number", + "format": "double", + "nullable": true + }, + "profilePicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "backgroundPicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "tags": { + "maxItems": 10, + "minItems": 1, + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "countryCode": { + "type": "string", + "nullable": true + }, + "planet": { + "type": "string", + "nullable": true + }, + "nextRevalidation": { + "type": "string", + "format": "date-span", + "nullable": true + }, + "validatedAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "validatedAtDate": { + "type": "string", + "format": "date", + "nullable": true + }, + "validatedAtTime": { + "type": "string", + "format": "time", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateSocialMediaAccountRequest": { + "attributesInUpdateRequest": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/socialMediaAccountResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateSocialMediaAccountRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "socialMediaAccounts": "#/components/schemas/attributesInUpdateSocialMediaAccountRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateSocialMediaAccountRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "alternativeId": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "firstName": { + "maxLength": 20, + "minLength": 2, + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "userName": { + "maxLength": 18, + "minLength": 3, + "pattern": "^[a-zA-Z]+$", + "type": "string", + "nullable": true + }, + "creditCard": { + "type": "string", + "format": "credit-card", + "nullable": true + }, + "email": { + "type": "string", + "format": "email", + "nullable": true + }, + "password": { + "maxLength": 60, + "minLength": 20, + "type": "string", + "format": "byte", + "nullable": true + }, + "phone": { + "type": "string", + "format": "tel", + "nullable": true + }, + "age": { + "maximum": 122.9, + "exclusiveMaximum": true, + "minimum": 0.1, + "exclusiveMinimum": true, + "type": "number", + "format": "double", + "nullable": true + }, + "profilePicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "backgroundPicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "tags": { + "maxItems": 10, + "minItems": 1, + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "countryCode": { + "type": "string", + "nullable": true + }, + "planet": { + "type": "string", + "nullable": true + }, + "nextRevalidation": { + "type": "string", + "format": "date-span", + "nullable": true + }, + "validatedAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "validatedAtDate": { + "type": "string", + "format": "date", + "nullable": true + }, + "validatedAtTime": { + "type": "string", + "format": "time", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInResponse": { + "createSocialMediaAccountRequestDocument": { "required": [ - "type" + "data" ], "type": "object", "properties": { - "type": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/resourceType" + "$ref": "#/components/schemas/dataInCreateSocialMediaAccountRequest" } ] }, @@ -519,49 +664,94 @@ ] } }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "socialMediaAccounts": "#/components/schemas/socialMediaAccountDataInResponse" - } - }, - "x-abstract": true + "additionalProperties": false }, - "dataInUpdateSocialMediaAccountRequest": { - "required": [ - "id", - "type" - ], + "dataInCreateSocialMediaAccountRequest": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/socialMediaAccountResourceType" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateSocialMediaAccountRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInSocialMediaAccountResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateSocialMediaAccountRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInSocialMediaAccountResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateSocialMediaAccountRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateSocialMediaAccountRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "errorLinks": { @@ -692,200 +882,115 @@ "nullable": true } }, - "resourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourceTopLevelLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourceType": { - "enum": [ - "socialMediaAccounts" + "primarySocialMediaAccountResponseDocument": { + "required": [ + "data", + "links" ], - "type": "string" - }, - "socialMediaAccountAttributesInResponse": { "type": "object", "properties": { - "alternativeId": { - "type": "string", - "format": "uuid", - "nullable": true - }, - "firstName": { - "maxLength": 20, - "minLength": 2, - "type": "string", - "nullable": true - }, - "lastName": { - "type": "string" - }, - "userName": { - "maxLength": 18, - "minLength": 3, - "pattern": "^[a-zA-Z]+$", - "type": "string", - "nullable": true - }, - "creditCard": { - "type": "string", - "format": "credit-card", - "nullable": true - }, - "email": { - "type": "string", - "format": "email", - "nullable": true - }, - "password": { - "maxLength": 60, - "minLength": 20, - "type": "string", - "format": "byte", - "nullable": true - }, - "phone": { - "type": "string", - "format": "tel", - "nullable": true - }, - "age": { - "maximum": 122.9, - "exclusiveMaximum": true, - "minimum": 0.1, - "exclusiveMinimum": true, - "type": "number", - "format": "double", - "nullable": true - }, - "profilePicture": { - "type": "string", - "format": "uri", - "nullable": true + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] }, - "backgroundPicture": { - "type": "string", - "format": "uri", - "nullable": true + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInSocialMediaAccountResponse" + } + ] }, - "tags": { - "maxItems": 10, - "minItems": 1, + "included": { "type": "array", "items": { - "type": "string" - }, - "nullable": true - }, - "countryCode": { - "type": "string", - "nullable": true - }, - "planet": { - "type": "string", - "nullable": true - }, - "nextRevalidation": { - "type": "string", - "format": "date-span", - "nullable": true - }, - "validatedAt": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "validatedAtDate": { - "type": "string", - "format": "date", - "nullable": true + "$ref": "#/components/schemas/resourceInResponse" + } }, - "validatedAtTime": { - "type": "string", - "format": "time", - "nullable": true + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false }, - "socialMediaAccountDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "uuid" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/socialMediaAccountAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" } - }, - "additionalProperties": false + ] } - ], - "additionalProperties": false + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "socialMediaAccounts": "#/components/schemas/dataInCreateSocialMediaAccountRequest" + } + }, + "x-abstract": true }, - "socialMediaAccountPrimaryResponseDocument": { + "resourceInResponse": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/resourceType" } ] }, - "data": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/socialMediaAccountDataInResponse" + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "socialMediaAccounts": "#/components/schemas/dataInSocialMediaAccountResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" } ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } }, "meta": { "allOf": [ @@ -895,9 +1000,37 @@ ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "socialMediaAccounts": "#/components/schemas/dataInUpdateSocialMediaAccountRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, "additionalProperties": false }, - "socialMediaAccountResourceType": { + "resourceType": { "enum": [ "socialMediaAccounts" ], diff --git a/test/OpenApiTests/ModelStateValidation/ModelStateValidationTests.cs b/test/OpenApiTests/ModelStateValidation/ModelStateValidationTests.cs index 63ac40de2c..e91a7f7f03 100644 --- a/test/OpenApiTests/ModelStateValidation/ModelStateValidationTests.cs +++ b/test/OpenApiTests/ModelStateValidation/ModelStateValidationTests.cs @@ -11,7 +11,7 @@ public sealed class ModelStateValidationTests : IClassFixture, ModelStateValidationDbContext> _testContext; @@ -33,7 +33,7 @@ public async Task Guid_type_produces_expected_schema(string modelName) JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.alternativeId").With(alternativeIdElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.alternativeId").With(alternativeIdElement => { alternativeIdElement.Should().HaveProperty("type", "string"); alternativeIdElement.Should().HaveProperty("format", "uuid"); @@ -48,7 +48,7 @@ public async Task Length_annotation_on_resource_string_property_produces_expecte JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.firstName").With(firstNameElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.firstName").With(firstNameElement => { firstNameElement.Should().HaveProperty("type", "string"); firstNameElement.Should().HaveProperty("maxLength", 20); @@ -64,7 +64,7 @@ public async Task Required_annotation_with_AllowEmptyStrings_on_resource_propert JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.lastName").With(lastNameElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.lastName").With(lastNameElement => { lastNameElement.Should().HaveProperty("type", "string"); lastNameElement.Should().NotContainPath("minLength"); @@ -79,7 +79,7 @@ public async Task StringLength_annotation_on_resource_property_produces_expected JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.userName").With(userNameElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.userName").With(userNameElement => { userNameElement.Should().HaveProperty("type", "string"); userNameElement.Should().HaveProperty("maxLength", 18); @@ -95,7 +95,7 @@ public async Task RegularExpression_annotation_on_resource_property_produces_exp JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.userName").With(userNameElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.userName").With(userNameElement => { userNameElement.Should().HaveProperty("type", "string"); userNameElement.Should().HaveProperty("pattern", "^[a-zA-Z]+$"); @@ -110,7 +110,7 @@ public async Task CreditCard_annotation_on_resource_property_produces_expected_s JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.creditCard").With(creditCardElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.creditCard").With(creditCardElement => { creditCardElement.Should().HaveProperty("type", "string"); creditCardElement.Should().HaveProperty("format", "credit-card"); @@ -125,7 +125,7 @@ public async Task Email_annotation_on_resource_property_produces_expected_schema JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.email").With(emailElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.email").With(emailElement => { emailElement.Should().HaveProperty("type", "string"); emailElement.Should().HaveProperty("format", "email"); @@ -140,7 +140,7 @@ public async Task Min_max_length_annotation_on_resource_property_produces_expect JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.password").With(passwordElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.password").With(passwordElement => { passwordElement.Should().HaveProperty("type", "string"); passwordElement.Should().HaveProperty("format", "byte"); @@ -157,7 +157,7 @@ public async Task Phone_annotation_on_resource_property_produces_expected_schema JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.phone").With(phoneElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.phone").With(phoneElement => { phoneElement.Should().HaveProperty("type", "string"); phoneElement.Should().HaveProperty("format", "tel"); @@ -172,7 +172,7 @@ public async Task Range_annotation_on_resource_property_produces_expected_schema JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.age").With(ageElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.age").With(ageElement => { ageElement.Should().HaveProperty("type", "number"); ageElement.Should().HaveProperty("format", "double"); @@ -191,7 +191,7 @@ public async Task Url_annotation_on_resource_property_produces_expected_schema(s JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.profilePicture").With(profilePictureElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.profilePicture").With(profilePictureElement => { profilePictureElement.Should().HaveProperty("type", "string"); profilePictureElement.Should().HaveProperty("format", "uri"); @@ -206,7 +206,7 @@ public async Task Uri_type_produces_expected_schema(string modelName) JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.backgroundPicture").With(backgroundPictureElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.backgroundPicture").With(backgroundPictureElement => { backgroundPictureElement.Should().HaveProperty("type", "string"); backgroundPictureElement.Should().HaveProperty("format", "uri"); @@ -221,7 +221,7 @@ public async Task Length_annotation_on_resource_list_property_produces_expected_ JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.tags").With(tagsElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.tags").With(tagsElement => { tagsElement.Should().HaveProperty("type", "array"); tagsElement.Should().HaveProperty("maxItems", 10); @@ -242,7 +242,7 @@ public async Task TimeSpan_range_annotation_on_resource_property_produces_expect JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.nextRevalidation").With(nextRevalidationElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.nextRevalidation").With(nextRevalidationElement => { nextRevalidationElement.Should().HaveProperty("type", "string"); nextRevalidationElement.Should().HaveProperty("format", "date-span"); @@ -257,7 +257,7 @@ public async Task DateTime_type_produces_expected_schema(string modelName) JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.validatedAt").With(validatedAtElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAt").With(validatedAtElement => { validatedAtElement.Should().HaveProperty("type", "string"); validatedAtElement.Should().HaveProperty("format", "date-time"); @@ -272,7 +272,7 @@ public async Task DateOnly_type_produces_expected_schema(string modelName) JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.validatedAtDate").With(validatedDateAtElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAtDate").With(validatedDateAtElement => { validatedDateAtElement.Should().HaveProperty("type", "string"); validatedDateAtElement.Should().HaveProperty("format", "date"); @@ -287,7 +287,7 @@ public async Task TimeOnly_type_produces_expected_schema(string modelName) JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath($"components.schemas.{modelName}.properties.validatedAtTime").With(validatedTimeAtElement => + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAtTime").With(validatedTimeAtElement => { validatedTimeAtElement.Should().HaveProperty("type", "string"); validatedTimeAtElement.Should().HaveProperty("format", "time"); diff --git a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs index 602da50581..d064c466c9 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs @@ -6,6 +6,9 @@ namespace OpenApiTests.NamingConventions.CamelCase; public sealed class CamelCaseTests : IClassFixture, NamingConventionDbContext>> { + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; + private readonly OpenApiTestContext, NamingConventionDbContext> _testContext; public CamelCaseTests(OpenApiTestContext, NamingConventionDbContext> testContext) @@ -35,7 +38,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() operationElement.Should().Be("getSupermarketCollection"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("supermarketCollectionResponseDocument").SchemaReferenceId; }); @@ -51,7 +54,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") .ShouldBeSchemaReferenceId("resourceCollectionTopLevelLinks").SchemaReferenceId; - resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("supermarketDataInResponse") + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("dataInSupermarketResponse") .SchemaReferenceId; }); @@ -70,12 +73,12 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() string? resourceRelationshipInResponseSchemaRefId = null; string abstractResourceDataSchemaRefId = schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[0].$ref") - .ShouldBeSchemaReferenceId("dataInResponse").SchemaReferenceId; + .ShouldBeSchemaReferenceId("resourceInResponse").SchemaReferenceId; schemasElement.Should().ContainPath($"{abstractResourceDataSchemaRefId}.discriminator.mapping").With(mappingElement => { - mappingElement.Should().ContainPath("supermarkets").ShouldBeSchemaReferenceId("supermarketDataInResponse"); - mappingElement.Should().ContainPath("staffMembers").ShouldBeSchemaReferenceId("staffMemberDataInResponse"); + mappingElement.Should().ContainPath("supermarkets").ShouldBeSchemaReferenceId("dataInSupermarketResponse"); + mappingElement.Should().ContainPath("staffMembers").ShouldBeSchemaReferenceId("dataInStaffMemberResponse"); }); schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => @@ -84,10 +87,10 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() .SchemaReferenceId; resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") - .ShouldBeSchemaReferenceId("supermarketAttributesInResponse").SchemaReferenceId; + .ShouldBeSchemaReferenceId("attributesInSupermarketResponse").SchemaReferenceId; resourceRelationshipInResponseSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") - .ShouldBeSchemaReferenceId("supermarketRelationshipsInResponse").SchemaReferenceId; + .ShouldBeSchemaReferenceId("relationshipsInSupermarketResponse").SchemaReferenceId; }); schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => @@ -95,7 +98,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainProperty("self"); }); - schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("nameOfCity"); propertiesElement.Should().ContainProperty("kind"); @@ -104,7 +107,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() string? nullableToOneResourceResponseDataSchemaRefId = null; - schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("storeManager"); @@ -166,8 +169,8 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() operationElement.Should().Be("getSupermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("supermarketPrimaryResponseDocument").SchemaReferenceId; + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("primarySupermarketResponseDocument").SchemaReferenceId; }); document.Should().ContainPath("components.schemas").With(schemasElement => @@ -204,8 +207,8 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin operationElement.Should().Be("getSupermarketStoreManager"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("staffMemberSecondaryResponseDocument").SchemaReferenceId; + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("secondaryStaffMemberResponseDocument").SchemaReferenceId; }); document.Should().ContainPath("components.schemas").With(schemasElement => @@ -214,13 +217,13 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("staffMemberDataInResponse") + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("dataInStaffMemberResponse") .SchemaReferenceId; }); schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { - propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("staffMemberAttributesInResponse"); + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributesInStaffMemberResponse"); }); }); } @@ -239,8 +242,8 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nul operationElement.Should().Be("getSupermarketBackupStoreManager"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("nullableStaffMemberSecondaryResponseDocument"); + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("nullableSecondaryStaffMemberResponseDocument"); }); } @@ -258,7 +261,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_res operationElement.Should().Be("getSupermarketCashiers"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("staffMemberCollectionResponseDocument"); }); } @@ -279,7 +282,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("getSupermarketStoreManagerRelationship"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("staffMemberIdentifierResponseDocument").SchemaReferenceId; }); @@ -316,7 +319,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("getSupermarketBackupStoreManagerRelationship"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("nullableStaffMemberIdentifierResponseDocument"); }); } @@ -337,7 +340,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("getSupermarketCashiersRelationship"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("staffMemberIdentifierCollectionResponseDocument").SchemaReferenceId; }); @@ -380,7 +383,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() operationElement.Should().Be("postSupermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("requestBody.content['application/vnd.api+json'].schema.allOf[0].$ref") + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("createSupermarketRequestDocument").SchemaReferenceId; }); @@ -396,7 +399,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() string? resourceRelationshipInPostRequestSchemaRefId = null; - schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributesInCreateSupermarketRequest"); @@ -404,7 +407,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() .ShouldBeSchemaReferenceId("relationshipsInCreateSupermarketRequest").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("storeManager"); propertiesElement.Should().ContainPath("storeManager.allOf[0].$ref").ShouldBeSchemaReferenceId("toOneStaffMemberInRequest"); @@ -450,7 +453,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() operationElement.Should().Be("patchSupermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("requestBody.content['application/vnd.api+json'].schema.allOf[0].$ref") + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("updateSupermarketRequestDocument").SchemaReferenceId; }); @@ -464,7 +467,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() .ShouldBeSchemaReferenceId("dataInUpdateSupermarketRequest").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributesInUpdateSupermarketRequest"); propertiesElement.Should().ContainPath("relationships.allOf[0].$ref").ShouldBeSchemaReferenceId("relationshipsInUpdateSupermarketRequest"); @@ -566,10 +569,10 @@ public async Task Casing_convention_is_applied_to_PostOperations_endpoint() operationElement.Should().Be("postOperations"); }); - getElement.Should().ContainPath("requestBody.content['application/vnd.api+json; ext=atomic'].schema.allOf[0].$ref") + getElement.Should().ContainPath($"requestBody.content{EscapedOperationsMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("operationsRequestDocument"); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json; ext=atomic'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedOperationsMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("operationsResponseDocument"); }); diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json index 5c4cae0ae1..7a22ed8d57 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -20,7 +20,7 @@ "requestBody": { "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "allOf": [ { @@ -36,7 +36,7 @@ "200": { "description": "All operations were successfully applied, which resulted in additional changes.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/operationsResponseDocument" } @@ -49,7 +49,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -59,7 +59,7 @@ "403": { "description": "An operation is not accessible or a client-generated ID is used.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -69,7 +69,7 @@ "404": { "description": "A resource or a related resource does not exist.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -79,7 +79,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -89,7 +89,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -142,7 +142,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" } @@ -164,7 +164,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -265,7 +265,7 @@ "requestBody": { "description": "The attributes and relationships of the staffMember to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -291,9 +291,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staffMemberPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" } } } @@ -304,7 +304,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -314,7 +314,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -324,7 +324,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -334,7 +334,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -344,7 +344,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -408,9 +408,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staffMemberPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" } } } @@ -430,7 +430,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -440,7 +440,7 @@ "404": { "description": "The staffMember does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -566,7 +566,7 @@ "requestBody": { "description": "The attributes and relationships of the staffMember to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -582,9 +582,9 @@ "200": { "description": "The staffMember was successfully updated, which resulted in additional changes. The updated staffMember is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staffMemberPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" } } } @@ -595,7 +595,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -605,7 +605,7 @@ "404": { "description": "The staffMember or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -615,7 +615,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -625,7 +625,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -660,7 +660,7 @@ "404": { "description": "The staffMember does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -713,7 +713,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/supermarketCollectionResponseDocument" } @@ -735,7 +735,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -836,7 +836,7 @@ "requestBody": { "description": "The attributes and relationships of the supermarket to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -862,9 +862,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/supermarketPrimaryResponseDocument" + "$ref": "#/components/schemas/primarySupermarketResponseDocument" } } } @@ -875,7 +875,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -885,7 +885,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -895,7 +895,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -905,7 +905,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -915,7 +915,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -979,9 +979,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/supermarketPrimaryResponseDocument" + "$ref": "#/components/schemas/primarySupermarketResponseDocument" } } } @@ -1001,7 +1001,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1011,7 +1011,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1137,7 +1137,7 @@ "requestBody": { "description": "The attributes and relationships of the supermarket to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1153,9 +1153,9 @@ "200": { "description": "The supermarket was successfully updated, which resulted in additional changes. The updated supermarket is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/supermarketPrimaryResponseDocument" + "$ref": "#/components/schemas/primarySupermarketResponseDocument" } } } @@ -1166,7 +1166,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1176,7 +1176,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1186,7 +1186,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1196,7 +1196,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1231,7 +1231,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1295,9 +1295,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableStaffMemberSecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryStaffMemberResponseDocument" } } } @@ -1317,7 +1317,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1327,7 +1327,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1473,7 +1473,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableStaffMemberIdentifierResponseDocument" } @@ -1495,7 +1495,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1505,7 +1505,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1618,7 +1618,7 @@ "requestBody": { "description": "The identity of the staffMember to assign to the backupStoreManager relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1637,7 +1637,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1647,7 +1647,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1657,7 +1657,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1667,7 +1667,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1731,7 +1731,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" } @@ -1753,7 +1753,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1763,7 +1763,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1909,7 +1909,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staffMemberIdentifierCollectionResponseDocument" } @@ -1931,7 +1931,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1941,7 +1941,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2054,7 +2054,7 @@ "requestBody": { "description": "The identities of the staffMembers to add to the cashiers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2073,7 +2073,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2083,7 +2083,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2093,7 +2093,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2103,7 +2103,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2134,7 +2134,7 @@ "requestBody": { "description": "The identities of the staffMembers to assign to the cashiers relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2153,7 +2153,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2163,7 +2163,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2173,7 +2173,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2183,7 +2183,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2214,7 +2214,7 @@ "requestBody": { "description": "The identities of the staffMembers to remove from the cashiers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2233,7 +2233,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2243,7 +2243,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2253,7 +2253,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2263,7 +2263,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2327,9 +2327,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staffMemberSecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryStaffMemberResponseDocument" } } } @@ -2349,7 +2349,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2359,7 +2359,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2505,7 +2505,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staffMemberIdentifierResponseDocument" } @@ -2527,7 +2527,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2537,7 +2537,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2650,7 +2650,7 @@ "requestBody": { "description": "The identity of the staffMember to assign to the storeManager relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2669,7 +2669,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2679,7 +2679,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2689,7 +2689,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2699,7 +2699,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2799,7 +2799,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } ] }, @@ -2813,68 +2813,217 @@ }, "additionalProperties": false }, - "attributesInCreateStaffMemberRequest": { + "attributesInCreateRequest": { "required": [ - "name" + "openapi:discriminator" ], "type": "object", "properties": { - "name": { - "type": "string" - }, - "age": { - "type": "integer", - "format": "int32" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staffMembers": "#/components/schemas/attributesInCreateStaffMemberRequest", + "supermarkets": "#/components/schemas/attributesInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "attributesInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "nameOfCity" + ], + "type": "object", + "properties": { + "nameOfCity": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { "required": [ - "nameOfCity" + "openapi:discriminator" ], "type": "object", "properties": { - "nameOfCity": { - "type": "string" - }, - "kind": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/supermarketType" + "$ref": "#/components/schemas/resourceType" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staffMembers": "#/components/schemas/attributesInStaffMemberResponse", + "supermarkets": "#/components/schemas/attributesInSupermarketResponse" + } + }, + "x-abstract": true + }, + "attributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "attributesInUpdateStaffMemberRequest": { - "type": "object", - "properties": { - "name": { - "type": "string" + "attributesInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "age": { - "type": "integer", - "format": "int32" + { + "type": "object", + "properties": { + "nameOfCity": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketType" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateSupermarketRequest": { + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "nameOfCity": { - "type": "string" - }, - "kind": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/supermarketType" + "$ref": "#/components/schemas/resourceType" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staffMembers": "#/components/schemas/attributesInUpdateStaffMemberRequest", + "supermarkets": "#/components/schemas/attributesInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nameOfCity": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "createStaffMemberOperation": { @@ -2988,194 +3137,210 @@ "additionalProperties": false }, "dataInCreateStaffMemberRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/staffMemberResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateStaffMemberRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStaffMemberRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInCreateSupermarketRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarketResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateSupermarketRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateSupermarketRequest" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateSupermarketRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInResponse": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceType" - } - ] + "dataInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInSupermarketResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInSupermarketResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "staffMembers": "#/components/schemas/staffMemberDataInResponse", - "supermarkets": "#/components/schemas/supermarketDataInResponse" + }, + "additionalProperties": false } - }, - "x-abstract": true + ], + "additionalProperties": false }, "dataInUpdateStaffMemberRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/staffMemberResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateStaffMemberRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStaffMemberRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInUpdateSupermarketRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarketResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateSupermarketRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateSupermarketRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateSupermarketRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "deleteStaffMemberOperation": { @@ -3371,6 +3536,37 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "supermarkets": "#/components/schemas/supermarketIdentifierInRequest" + } + }, + "x-abstract": true + }, "jsonapi": { "type": "object", "properties": { @@ -3405,7 +3601,7 @@ "nullable": true } }, - "nullableStaffMemberIdentifierResponseDocument": { + "nullableSecondaryStaffMemberResponseDocument": { "required": [ "data", "links" @@ -3422,18 +3618,24 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + "$ref": "#/components/schemas/dataInStaffMemberResponse" } ], "nullable": true }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, "meta": { "allOf": [ { @@ -3444,7 +3646,7 @@ }, "additionalProperties": false }, - "nullableStaffMemberSecondaryResponseDocument": { + "nullableStaffMemberIdentifierResponseDocument": { "required": [ "data", "links" @@ -3461,24 +3663,18 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/staffMemberDataInResponse" + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" } ], "nullable": true }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -3597,78 +3793,286 @@ { "$ref": "#/components/schemas/meta" } - ] - } - }, - "additionalProperties": false - }, - "relationshipLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "related": { - "type": "string" + ] + } + }, + "additionalProperties": false + }, + "primaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primarySupermarketResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInSupermarketResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationshipsInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "storeManager" + ], + "type": "object", + "properties": { + "storeManager": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStaffMemberInRequest" + } + ] + }, + "backupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneStaffMemberInRequest" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationshipsInSupermarketResponse" + } + }, + "x-abstract": true + }, + "relationshipsInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "storeManager": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStaffMemberInResponse" + } + ] + }, + "backupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneStaffMemberInResponse" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationshipsInCreateSupermarketRequest": { + "relationshipsInUpdateRequest": { "required": [ - "storeManager" + "openapi:discriminator" ], "type": "object", "properties": { - "storeManager": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStaffMemberInRequest" - } - ] - }, - "backupStoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneStaffMemberInRequest" - } - ] - }, - "cashiers": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyStaffMemberInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationshipsInUpdateSupermarketRequest" + } + }, + "x-abstract": true }, "relationshipsInUpdateSupermarketRequest": { - "type": "object", - "properties": { - "storeManager": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStaffMemberInRequest" - } - ] - }, - "backupStoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneStaffMemberInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "cashiers": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyStaffMemberInRequest" + { + "type": "object", + "properties": { + "storeManager": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStaffMemberInRequest" + } + ] + }, + "backupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneStaffMemberInRequest" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "removeFromSupermarketCashiersRelationshipOperation": { @@ -3782,80 +4186,19 @@ }, "additionalProperties": false }, - "resourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourceTopLevelLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourceType": { - "enum": [ - "staffMembers", - "supermarkets" - ], - "type": "string" - }, - "staffMemberAttributesInResponse": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "age": { - "type": "integer", - "format": "int32" - } - }, - "additionalProperties": false - }, - "staffMemberCollectionResponseDocument": { + "resourceInCreateRequest": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceType" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/staffMemberDataInResponse" - } - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -3864,71 +4207,29 @@ ] } }, - "additionalProperties": false - }, - "staffMemberDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/staffMemberAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/dataInCreateStaffMemberRequest", + "supermarkets": "#/components/schemas/dataInCreateSupermarketRequest" } - ], - "additionalProperties": false + }, + "x-abstract": true }, - "staffMemberIdentifierCollectionResponseDocument": { + "resourceInResponse": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceType" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/staffMemberIdentifierInResponse" - } - }, "meta": { "allOf": [ { @@ -3937,9 +4238,17 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/dataInStaffMemberResponse", + "supermarkets": "#/components/schemas/dataInSupermarketResponse" + } + }, + "x-abstract": true }, - "staffMemberIdentifierInRequest": { + "resourceInUpdateRequest": { "required": [ "type" ], @@ -3948,19 +4257,10 @@ "type": { "allOf": [ { - "$ref": "#/components/schemas/staffMemberResourceType" + "$ref": "#/components/schemas/resourceType" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, "meta": { "allOf": [ { @@ -3969,26 +4269,77 @@ ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/dataInUpdateStaffMemberRequest", + "supermarkets": "#/components/schemas/dataInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, "additionalProperties": false }, - "staffMemberIdentifierInResponse": { + "resourceType": { + "enum": [ + "staffMembers", + "supermarkets" + ], + "type": "string" + }, + "secondaryStaffMemberResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "jsonapi": { "allOf": [ { - "$ref": "#/components/schemas/staffMemberResourceType" + "$ref": "#/components/schemas/jsonapi" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -4000,7 +4351,7 @@ }, "additionalProperties": false }, - "staffMemberIdentifierResponseDocument": { + "staffMemberCollectionResponseDocument": { "required": [ "data", "links" @@ -4017,16 +4368,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/staffMemberIdentifierInResponse" - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -4038,7 +4394,7 @@ }, "additionalProperties": false }, - "staffMemberPrimaryResponseDocument": { + "staffMemberIdentifierCollectionResponseDocument": { "required": [ "data", "links" @@ -4055,21 +4411,14 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/staffMemberDataInResponse" - } - ] - }, - "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" } }, "meta": { @@ -4082,13 +4431,60 @@ }, "additionalProperties": false }, - "staffMemberResourceType": { - "enum": [ - "staffMembers" + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } ], - "type": "string" + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false }, - "staffMemberSecondaryResponseDocument": { + "staffMemberIdentifierResponseDocument": { "required": [ "data", "links" @@ -4105,23 +4501,17 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/staffMemberDataInResponse" + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -4132,21 +4522,11 @@ }, "additionalProperties": false }, - "supermarketAttributesInResponse": { - "type": "object", - "properties": { - "nameOfCity": { - "type": "string" - }, - "kind": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarketType" - } - ] - } - }, - "additionalProperties": false + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" }, "supermarketBackupStoreManagerRelationshipIdentifier": { "required": [ @@ -4250,13 +4630,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/supermarketDataInResponse" + "$ref": "#/components/schemas/dataInSupermarketResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4269,15 +4649,13 @@ }, "additionalProperties": false }, - "supermarketDataInResponse": { + "supermarketIdentifierInRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/identifierInRequest" }, { - "required": [ - "id" - ], "type": "object", "properties": { "id": { @@ -4285,26 +4663,9 @@ "type": "string", "format": "int32" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarketAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarketRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] + "lid": { + "minLength": 1, + "type": "string" } }, "additionalProperties": false @@ -4312,109 +4673,6 @@ ], "additionalProperties": false }, - "supermarketIdentifierInRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarketResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "supermarketPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarketDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "supermarketRelationshipsInResponse": { - "type": "object", - "properties": { - "storeManager": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneStaffMemberInResponse" - } - ] - }, - "backupStoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneStaffMemberInResponse" - } - ] - }, - "cashiers": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyStaffMemberInResponse" - } - ] - } - }, - "additionalProperties": false - }, "supermarketResourceType": { "enum": [ "supermarkets" diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json index c645f772dc..1955060d71 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -20,7 +20,7 @@ "requestBody": { "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "allOf": [ { @@ -36,7 +36,7 @@ "200": { "description": "All operations were successfully applied, which resulted in additional changes.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/operations-response-document" } @@ -49,7 +49,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -59,7 +59,7 @@ "403": { "description": "An operation is not accessible or a client-generated ID is used.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -69,7 +69,7 @@ "404": { "description": "A resource or a related resource does not exist.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -79,7 +79,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -89,7 +89,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -142,7 +142,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staff-member-collection-response-document" } @@ -164,7 +164,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -265,7 +265,7 @@ "requestBody": { "description": "The attributes and relationships of the staff-member to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -291,9 +291,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staff-member-primary-response-document" + "$ref": "#/components/schemas/primary-staff-member-response-document" } } } @@ -304,7 +304,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -314,7 +314,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -324,7 +324,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -334,7 +334,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -344,7 +344,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -408,9 +408,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staff-member-primary-response-document" + "$ref": "#/components/schemas/primary-staff-member-response-document" } } } @@ -430,7 +430,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -440,7 +440,7 @@ "404": { "description": "The staff-member does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -566,7 +566,7 @@ "requestBody": { "description": "The attributes and relationships of the staff-member to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -582,9 +582,9 @@ "200": { "description": "The staff-member was successfully updated, which resulted in additional changes. The updated staff-member is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staff-member-primary-response-document" + "$ref": "#/components/schemas/primary-staff-member-response-document" } } } @@ -595,7 +595,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -605,7 +605,7 @@ "404": { "description": "The staff-member or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -615,7 +615,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -625,7 +625,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -660,7 +660,7 @@ "404": { "description": "The staff-member does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -713,7 +713,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/supermarket-collection-response-document" } @@ -735,7 +735,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -836,7 +836,7 @@ "requestBody": { "description": "The attributes and relationships of the supermarket to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -862,9 +862,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/supermarket-primary-response-document" + "$ref": "#/components/schemas/primary-supermarket-response-document" } } } @@ -875,7 +875,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -885,7 +885,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -895,7 +895,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -905,7 +905,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -915,7 +915,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -979,9 +979,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/supermarket-primary-response-document" + "$ref": "#/components/schemas/primary-supermarket-response-document" } } } @@ -1001,7 +1001,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1011,7 +1011,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1137,7 +1137,7 @@ "requestBody": { "description": "The attributes and relationships of the supermarket to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1153,9 +1153,9 @@ "200": { "description": "The supermarket was successfully updated, which resulted in additional changes. The updated supermarket is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/supermarket-primary-response-document" + "$ref": "#/components/schemas/primary-supermarket-response-document" } } } @@ -1166,7 +1166,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1176,7 +1176,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1186,7 +1186,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1196,7 +1196,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1231,7 +1231,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1295,9 +1295,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullable-staff-member-secondary-response-document" + "$ref": "#/components/schemas/nullable-secondary-staff-member-response-document" } } } @@ -1317,7 +1317,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1327,7 +1327,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1473,7 +1473,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullable-staff-member-identifier-response-document" } @@ -1495,7 +1495,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1505,7 +1505,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1618,7 +1618,7 @@ "requestBody": { "description": "The identity of the staff-member to assign to the backup-store-manager relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1637,7 +1637,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1647,7 +1647,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1657,7 +1657,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1667,7 +1667,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1731,7 +1731,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staff-member-collection-response-document" } @@ -1753,7 +1753,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1763,7 +1763,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1909,7 +1909,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staff-member-identifier-collection-response-document" } @@ -1931,7 +1931,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -1941,7 +1941,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2054,7 +2054,7 @@ "requestBody": { "description": "The identities of the staff-members to add to the cashiers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2073,7 +2073,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2083,7 +2083,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2093,7 +2093,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2103,7 +2103,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2134,7 +2134,7 @@ "requestBody": { "description": "The identities of the staff-members to assign to the cashiers relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2153,7 +2153,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2163,7 +2163,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2173,7 +2173,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2183,7 +2183,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2214,7 +2214,7 @@ "requestBody": { "description": "The identities of the staff-members to remove from the cashiers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2233,7 +2233,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2243,7 +2243,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2253,7 +2253,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2263,7 +2263,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2327,9 +2327,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/staff-member-secondary-response-document" + "$ref": "#/components/schemas/secondary-staff-member-response-document" } } } @@ -2349,7 +2349,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2359,7 +2359,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2505,7 +2505,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/staff-member-identifier-response-document" } @@ -2527,7 +2527,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2537,7 +2537,7 @@ "404": { "description": "The supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2650,7 +2650,7 @@ "requestBody": { "description": "The identity of the staff-member to assign to the store-manager relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2669,7 +2669,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2679,7 +2679,7 @@ "404": { "description": "The supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2689,7 +2689,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2699,7 +2699,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/error-response-document" } @@ -2799,7 +2799,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } ] }, @@ -2813,68 +2813,217 @@ }, "additionalProperties": false }, - "attributes-in-create-staff-member-request": { + "attributes-in-create-request": { "required": [ - "name" + "openapi:discriminator" ], "type": "object", "properties": { - "name": { - "type": "string" - }, - "age": { - "type": "integer", - "format": "int32" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staff-members": "#/components/schemas/attributes-in-create-staff-member-request", + "supermarkets": "#/components/schemas/attributes-in-create-supermarket-request" + } + }, + "x-abstract": true + }, + "attributes-in-create-staff-member-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "attributes-in-create-supermarket-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "name-of-city" + ], + "type": "object", + "properties": { + "name-of-city": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-type" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-response": { "required": [ - "name-of-city" + "openapi:discriminator" ], "type": "object", "properties": { - "name-of-city": { - "type": "string" - }, - "kind": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/supermarket-type" + "$ref": "#/components/schemas/resource-type" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staff-members": "#/components/schemas/attributes-in-staff-member-response", + "supermarkets": "#/components/schemas/attributes-in-supermarket-response" + } + }, + "x-abstract": true + }, + "attributes-in-staff-member-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "attributes-in-update-staff-member-request": { - "type": "object", - "properties": { - "name": { - "type": "string" + "attributes-in-supermarket-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" }, - "age": { - "type": "integer", - "format": "int32" + { + "type": "object", + "properties": { + "name-of-city": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-type" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributes-in-update-supermarket-request": { + "attributes-in-update-request": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "name-of-city": { - "type": "string" - }, - "kind": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/supermarket-type" + "$ref": "#/components/schemas/resource-type" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staff-members": "#/components/schemas/attributes-in-update-staff-member-request", + "supermarkets": "#/components/schemas/attributes-in-update-supermarket-request" + } + }, + "x-abstract": true + }, + "attributes-in-update-staff-member-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-supermarket-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "name-of-city": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-type" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "create-staff-member-operation": { @@ -2988,194 +3137,210 @@ "additionalProperties": false }, "data-in-create-staff-member-request": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/staff-member-resource-type" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-staff-member-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-staff-member-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "data-in-create-supermarket-request": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarket-resource-type" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-create-supermarket-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-create-supermarket-request" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-supermarket-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-supermarket-request" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-staff-member-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-staff-member-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "data-in-response": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-type" - } - ] + "data-in-supermarket-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-supermarket-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-supermarket-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "staff-members": "#/components/schemas/staff-member-data-in-response", - "supermarkets": "#/components/schemas/supermarket-data-in-response" + }, + "additionalProperties": false } - }, - "x-abstract": true + ], + "additionalProperties": false }, "data-in-update-staff-member-request": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/staff-member-resource-type" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-staff-member-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-staff-member-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "data-in-update-supermarket-request": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarket-resource-type" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributes-in-update-supermarket-request" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationships-in-update-supermarket-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-supermarket-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-supermarket-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "delete-staff-member-operation": { @@ -3371,6 +3536,37 @@ }, "additionalProperties": false }, + "identifier-in-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/staff-member-identifier-in-request", + "supermarkets": "#/components/schemas/supermarket-identifier-in-request" + } + }, + "x-abstract": true + }, "jsonapi": { "type": "object", "properties": { @@ -3405,7 +3601,7 @@ "nullable": true } }, - "nullable-staff-member-identifier-response-document": { + "nullable-secondary-staff-member-response-document": { "required": [ "data", "links" @@ -3422,18 +3618,24 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-identifier-top-level-links" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/staff-member-identifier-in-response" + "$ref": "#/components/schemas/data-in-staff-member-response" } ], "nullable": true }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, "meta": { "allOf": [ { @@ -3444,7 +3646,7 @@ }, "additionalProperties": false }, - "nullable-staff-member-secondary-response-document": { + "nullable-staff-member-identifier-response-document": { "required": [ "data", "links" @@ -3461,24 +3663,18 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-top-level-links" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/staff-member-data-in-response" + "$ref": "#/components/schemas/staff-member-identifier-in-response" } ], "nullable": true }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, "meta": { "allOf": [ { @@ -3597,78 +3793,286 @@ { "$ref": "#/components/schemas/meta" } - ] - } - }, - "additionalProperties": false - }, - "relationship-links": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "related": { - "type": "string" + ] + } + }, + "additionalProperties": false + }, + "primary-staff-member-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-staff-member-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-supermarket-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-supermarket-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationship-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationships-in-create-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationships-in-create-supermarket-request" + } + }, + "x-abstract": true + }, + "relationships-in-create-supermarket-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "required": [ + "store-manager" + ], + "type": "object", + "properties": { + "store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-staff-member-in-request" + } + ] + }, + "backup-store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-staff-member-in-request" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-response": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationships-in-supermarket-response" + } + }, + "x-abstract": true + }, + "relationships-in-supermarket-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-staff-member-in-response" + } + ] + }, + "backup-store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-staff-member-in-response" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-response" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationships-in-create-supermarket-request": { + "relationships-in-update-request": { "required": [ - "store-manager" + "openapi:discriminator" ], "type": "object", "properties": { - "store-manager": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-staff-member-in-request" - } - ] - }, - "backup-store-manager": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-staff-member-in-request" - } - ] - }, - "cashiers": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/to-many-staff-member-in-request" + "$ref": "#/components/schemas/resource-type" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationships-in-update-supermarket-request" + } + }, + "x-abstract": true }, "relationships-in-update-supermarket-request": { - "type": "object", - "properties": { - "store-manager": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-staff-member-in-request" - } - ] - }, - "backup-store-manager": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-staff-member-in-request" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" }, - "cashiers": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-staff-member-in-request" + { + "type": "object", + "properties": { + "store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-staff-member-in-request" + } + ] + }, + "backup-store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-staff-member-in-request" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-request" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "remove-from-supermarket-cashiers-relationship-operation": { @@ -3782,80 +4186,19 @@ }, "additionalProperties": false }, - "resource-links": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resource-top-level-links": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resource-type": { - "enum": [ - "staff-members", - "supermarkets" - ], - "type": "string" - }, - "staff-member-attributes-in-response": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "age": { - "type": "integer", - "format": "int32" - } - }, - "additionalProperties": false - }, - "staff-member-collection-response-document": { + "resource-in-create-request": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resource-collection-top-level-links" + "$ref": "#/components/schemas/resource-type" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/staff-member-data-in-response" - } - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, "meta": { "allOf": [ { @@ -3864,71 +4207,29 @@ ] } }, - "additionalProperties": false - }, - "staff-member-data-in-response": { - "allOf": [ - { - "$ref": "#/components/schemas/data-in-response" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/staff-member-attributes-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] - } - }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/data-in-create-staff-member-request", + "supermarkets": "#/components/schemas/data-in-create-supermarket-request" } - ], - "additionalProperties": false + }, + "x-abstract": true }, - "staff-member-identifier-collection-response-document": { + "resource-in-response": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + "$ref": "#/components/schemas/resource-type" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/staff-member-identifier-in-response" - } - }, "meta": { "allOf": [ { @@ -3937,9 +4238,17 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/data-in-staff-member-response", + "supermarkets": "#/components/schemas/data-in-supermarket-response" + } + }, + "x-abstract": true }, - "staff-member-identifier-in-request": { + "resource-in-update-request": { "required": [ "type" ], @@ -3948,19 +4257,10 @@ "type": { "allOf": [ { - "$ref": "#/components/schemas/staff-member-resource-type" + "$ref": "#/components/schemas/resource-type" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, "meta": { "allOf": [ { @@ -3969,26 +4269,77 @@ ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/data-in-update-staff-member-request", + "supermarkets": "#/components/schemas/data-in-update-supermarket-request" + } + }, + "x-abstract": true + }, + "resource-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, "additionalProperties": false }, - "staff-member-identifier-in-response": { + "resource-type": { + "enum": [ + "staff-members", + "supermarkets" + ], + "type": "string" + }, + "secondary-staff-member-response-document": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "jsonapi": { "allOf": [ { - "$ref": "#/components/schemas/staff-member-resource-type" + "$ref": "#/components/schemas/jsonapi" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-staff-member-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } }, "meta": { "allOf": [ @@ -4000,7 +4351,7 @@ }, "additionalProperties": false }, - "staff-member-identifier-response-document": { + "staff-member-collection-response-document": { "required": [ "data", "links" @@ -4017,16 +4368,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-identifier-top-level-links" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/staff-member-identifier-in-response" - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-staff-member-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } }, "meta": { "allOf": [ @@ -4038,7 +4394,7 @@ }, "additionalProperties": false }, - "staff-member-primary-response-document": { + "staff-member-identifier-collection-response-document": { "required": [ "data", "links" @@ -4055,21 +4411,14 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-top-level-links" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/staff-member-data-in-response" - } - ] - }, - "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/staff-member-identifier-in-response" } }, "meta": { @@ -4082,13 +4431,60 @@ }, "additionalProperties": false }, - "staff-member-resource-type": { - "enum": [ - "staff-members" + "staff-member-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } ], - "type": "string" + "additionalProperties": false + }, + "staff-member-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-resource-type" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false }, - "staff-member-secondary-response-document": { + "staff-member-identifier-response-document": { "required": [ "data", "links" @@ -4105,23 +4501,17 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resource-top-level-links" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/staff-member-data-in-response" + "$ref": "#/components/schemas/staff-member-identifier-in-response" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, "meta": { "allOf": [ { @@ -4132,21 +4522,11 @@ }, "additionalProperties": false }, - "supermarket-attributes-in-response": { - "type": "object", - "properties": { - "name-of-city": { - "type": "string" - }, - "kind": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarket-type" - } - ] - } - }, - "additionalProperties": false + "staff-member-resource-type": { + "enum": [ + "staff-members" + ], + "type": "string" }, "supermarket-backup-store-manager-relationship-identifier": { "required": [ @@ -4250,13 +4630,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/supermarket-data-in-response" + "$ref": "#/components/schemas/data-in-supermarket-response" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/resource-in-response" } }, "meta": { @@ -4269,15 +4649,13 @@ }, "additionalProperties": false }, - "supermarket-data-in-response": { + "supermarket-identifier-in-request": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/data-in-response" + "$ref": "#/components/schemas/identifier-in-request" }, { - "required": [ - "id" - ], "type": "object", "properties": { "id": { @@ -4285,26 +4663,9 @@ "type": "string", "format": "int32" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarket-attributes-in-response" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarket-relationships-in-response" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-links" - } - ] + "lid": { + "minLength": 1, + "type": "string" } }, "additionalProperties": false @@ -4312,109 +4673,6 @@ ], "additionalProperties": false }, - "supermarket-identifier-in-request": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarket-resource-type" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "supermarket-primary-response-document": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resource-top-level-links" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/supermarket-data-in-response" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/data-in-response" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "supermarket-relationships-in-response": { - "type": "object", - "properties": { - "store-manager": { - "allOf": [ - { - "$ref": "#/components/schemas/to-one-staff-member-in-response" - } - ] - }, - "backup-store-manager": { - "allOf": [ - { - "$ref": "#/components/schemas/nullable-to-one-staff-member-in-response" - } - ] - }, - "cashiers": { - "allOf": [ - { - "$ref": "#/components/schemas/to-many-staff-member-in-response" - } - ] - } - }, - "additionalProperties": false - }, "supermarket-resource-type": { "enum": [ "supermarkets" diff --git a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs index 1fa5f35396..48a1520a6f 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs @@ -6,6 +6,9 @@ namespace OpenApiTests.NamingConventions.KebabCase; public sealed class KebabCaseTests : IClassFixture, NamingConventionDbContext>> { + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; + private readonly OpenApiTestContext, NamingConventionDbContext> _testContext; public KebabCaseTests(OpenApiTestContext, NamingConventionDbContext> testContext) @@ -35,7 +38,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() operationElement.Should().Be("get-supermarket-collection"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("supermarket-collection-response-document").SchemaReferenceId; }); @@ -51,7 +54,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") .ShouldBeSchemaReferenceId("resource-collection-top-level-links").SchemaReferenceId; - resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("supermarket-data-in-response") + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("data-in-supermarket-response") .SchemaReferenceId; }); @@ -70,12 +73,12 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() string? resourceRelationshipInResponseSchemaRefId = null; string abstractResourceDataSchemaRefId = schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[0].$ref") - .ShouldBeSchemaReferenceId("data-in-response").SchemaReferenceId; + .ShouldBeSchemaReferenceId("resource-in-response").SchemaReferenceId; schemasElement.Should().ContainPath($"{abstractResourceDataSchemaRefId}.discriminator.mapping").With(mappingElement => { - mappingElement.Should().ContainPath("supermarkets").ShouldBeSchemaReferenceId("supermarket-data-in-response"); - mappingElement.Should().ContainPath("staff-members").ShouldBeSchemaReferenceId("staff-member-data-in-response"); + mappingElement.Should().ContainPath("supermarkets").ShouldBeSchemaReferenceId("data-in-supermarket-response"); + mappingElement.Should().ContainPath("staff-members").ShouldBeSchemaReferenceId("data-in-staff-member-response"); }); schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => @@ -84,10 +87,10 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() .SchemaReferenceId; resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") - .ShouldBeSchemaReferenceId("supermarket-attributes-in-response").SchemaReferenceId; + .ShouldBeSchemaReferenceId("attributes-in-supermarket-response").SchemaReferenceId; resourceRelationshipInResponseSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") - .ShouldBeSchemaReferenceId("supermarket-relationships-in-response").SchemaReferenceId; + .ShouldBeSchemaReferenceId("relationships-in-supermarket-response").SchemaReferenceId; }); schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => @@ -95,7 +98,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainProperty("self"); }); - schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("name-of-city"); propertiesElement.Should().ContainProperty("kind"); @@ -104,7 +107,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() string? nullableToOneResourceResponseDataSchemaRefId = null; - schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("store-manager"); @@ -166,8 +169,8 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() operationElement.Should().Be("get-supermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("supermarket-primary-response-document").SchemaReferenceId; + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("primary-supermarket-response-document").SchemaReferenceId; }); document.Should().ContainPath("components.schemas").With(schemasElement => @@ -204,8 +207,8 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin operationElement.Should().Be("get-supermarket-store-manager"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("staff-member-secondary-response-document").SchemaReferenceId; + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("secondary-staff-member-response-document").SchemaReferenceId; }); document.Should().ContainPath("components.schemas").With(schemasElement => @@ -215,12 +218,12 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") - .ShouldBeSchemaReferenceId("staff-member-data-in-response").SchemaReferenceId; + .ShouldBeSchemaReferenceId("data-in-staff-member-response").SchemaReferenceId; }); schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { - propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("staff-member-attributes-in-response"); + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributes-in-staff-member-response"); }); }); } @@ -239,8 +242,8 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nul operationElement.Should().Be("get-supermarket-backup-store-manager"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("nullable-staff-member-secondary-response-document"); + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("nullable-secondary-staff-member-response-document"); }); } @@ -258,7 +261,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_res operationElement.Should().Be("get-supermarket-cashiers"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("staff-member-collection-response-document"); }); } @@ -279,7 +282,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("get-supermarket-store-manager-relationship"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("staff-member-identifier-response-document").SchemaReferenceId; }); @@ -316,7 +319,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("get-supermarket-backup-store-manager-relationship"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("nullable-staff-member-identifier-response-document"); }); } @@ -337,7 +340,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("get-supermarket-cashiers-relationship"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("staff-member-identifier-collection-response-document").SchemaReferenceId; }); @@ -380,7 +383,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() operationElement.Should().Be("post-supermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("requestBody.content['application/vnd.api+json'].schema.allOf[0].$ref") + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("create-supermarket-request-document").SchemaReferenceId; }); @@ -396,7 +399,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() string? resourceRelationshipInPostRequestSchemaRefId = null; - schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributes-in-create-supermarket-request"); @@ -404,7 +407,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() .ShouldBeSchemaReferenceId("relationships-in-create-supermarket-request").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("store-manager"); propertiesElement.Should().ContainPath("store-manager.allOf[0].$ref").ShouldBeSchemaReferenceId("to-one-staff-member-in-request"); @@ -452,7 +455,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() operationElement.Should().Be("patch-supermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("requestBody.content['application/vnd.api+json'].schema.allOf[0].$ref") + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("update-supermarket-request-document").SchemaReferenceId; }); @@ -466,7 +469,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() .ShouldBeSchemaReferenceId("data-in-update-supermarket-request").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributes-in-update-supermarket-request"); propertiesElement.Should().ContainPath("relationships.allOf[0].$ref").ShouldBeSchemaReferenceId("relationships-in-update-supermarket-request"); @@ -568,10 +571,10 @@ public async Task Casing_convention_is_applied_to_PostOperations_endpoint() operationElement.Should().Be("post-operations"); }); - getElement.Should().ContainPath("requestBody.content['application/vnd.api+json; ext=atomic'].schema.allOf[0].$ref") + getElement.Should().ContainPath($"requestBody.content{EscapedOperationsMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("operations-request-document"); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json; ext=atomic'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedOperationsMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("operations-response-document"); }); diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json index c3572c5780..ad97782721 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -20,7 +20,7 @@ "requestBody": { "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "allOf": [ { @@ -36,7 +36,7 @@ "200": { "description": "All operations were successfully applied, which resulted in additional changes.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/OperationsResponseDocument" } @@ -49,7 +49,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -59,7 +59,7 @@ "403": { "description": "An operation is not accessible or a client-generated ID is used.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -69,7 +69,7 @@ "404": { "description": "A resource or a related resource does not exist.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -79,7 +79,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -89,7 +89,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json; ext=atomic": { + "application/vnd.api+json; ext=atomic; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -142,7 +142,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/StaffMemberCollectionResponseDocument" } @@ -164,7 +164,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -265,7 +265,7 @@ "requestBody": { "description": "The attributes and relationships of the StaffMember to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -291,9 +291,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/StaffMemberPrimaryResponseDocument" + "$ref": "#/components/schemas/PrimaryStaffMemberResponseDocument" } } } @@ -304,7 +304,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -314,7 +314,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -324,7 +324,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -334,7 +334,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -344,7 +344,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -408,9 +408,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/StaffMemberPrimaryResponseDocument" + "$ref": "#/components/schemas/PrimaryStaffMemberResponseDocument" } } } @@ -430,7 +430,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -440,7 +440,7 @@ "404": { "description": "The StaffMember does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -566,7 +566,7 @@ "requestBody": { "description": "The attributes and relationships of the StaffMember to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -582,9 +582,9 @@ "200": { "description": "The StaffMember was successfully updated, which resulted in additional changes. The updated StaffMember is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/StaffMemberPrimaryResponseDocument" + "$ref": "#/components/schemas/PrimaryStaffMemberResponseDocument" } } } @@ -595,7 +595,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -605,7 +605,7 @@ "404": { "description": "The StaffMember or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -615,7 +615,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -625,7 +625,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -660,7 +660,7 @@ "404": { "description": "The StaffMember does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -713,7 +713,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/SupermarketCollectionResponseDocument" } @@ -735,7 +735,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -836,7 +836,7 @@ "requestBody": { "description": "The attributes and relationships of the Supermarket to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -862,9 +862,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/SupermarketPrimaryResponseDocument" + "$ref": "#/components/schemas/PrimarySupermarketResponseDocument" } } } @@ -875,7 +875,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -885,7 +885,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -895,7 +895,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -905,7 +905,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -915,7 +915,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -979,9 +979,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/SupermarketPrimaryResponseDocument" + "$ref": "#/components/schemas/PrimarySupermarketResponseDocument" } } } @@ -1001,7 +1001,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1011,7 +1011,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1137,7 +1137,7 @@ "requestBody": { "description": "The attributes and relationships of the Supermarket to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1153,9 +1153,9 @@ "200": { "description": "The Supermarket was successfully updated, which resulted in additional changes. The updated Supermarket is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/SupermarketPrimaryResponseDocument" + "$ref": "#/components/schemas/PrimarySupermarketResponseDocument" } } } @@ -1166,7 +1166,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1176,7 +1176,7 @@ "404": { "description": "The Supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1186,7 +1186,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1196,7 +1196,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1231,7 +1231,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1295,9 +1295,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/NullableStaffMemberSecondaryResponseDocument" + "$ref": "#/components/schemas/NullableSecondaryStaffMemberResponseDocument" } } } @@ -1317,7 +1317,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1327,7 +1327,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1473,7 +1473,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/NullableStaffMemberIdentifierResponseDocument" } @@ -1495,7 +1495,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1505,7 +1505,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1618,7 +1618,7 @@ "requestBody": { "description": "The identity of the StaffMember to assign to the BackupStoreManager relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1637,7 +1637,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1647,7 +1647,7 @@ "404": { "description": "The Supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1657,7 +1657,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1667,7 +1667,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1731,7 +1731,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/StaffMemberCollectionResponseDocument" } @@ -1753,7 +1753,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1763,7 +1763,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1909,7 +1909,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/StaffMemberIdentifierCollectionResponseDocument" } @@ -1931,7 +1931,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -1941,7 +1941,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2054,7 +2054,7 @@ "requestBody": { "description": "The identities of the StaffMembers to add to the Cashiers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2073,7 +2073,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2083,7 +2083,7 @@ "404": { "description": "The Supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2093,7 +2093,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2103,7 +2103,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2134,7 +2134,7 @@ "requestBody": { "description": "The identities of the StaffMembers to assign to the Cashiers relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2153,7 +2153,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2163,7 +2163,7 @@ "404": { "description": "The Supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2173,7 +2173,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2183,7 +2183,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2214,7 +2214,7 @@ "requestBody": { "description": "The identities of the StaffMembers to remove from the Cashiers relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2233,7 +2233,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2243,7 +2243,7 @@ "404": { "description": "The Supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2253,7 +2253,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2263,7 +2263,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2327,9 +2327,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/StaffMemberSecondaryResponseDocument" + "$ref": "#/components/schemas/SecondaryStaffMemberResponseDocument" } } } @@ -2349,7 +2349,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2359,7 +2359,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2505,7 +2505,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/StaffMemberIdentifierResponseDocument" } @@ -2527,7 +2527,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2537,7 +2537,7 @@ "404": { "description": "The Supermarket does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2650,7 +2650,7 @@ "requestBody": { "description": "The identity of the StaffMember to assign to the StoreManager relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2669,7 +2669,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2679,7 +2679,7 @@ "404": { "description": "The Supermarket or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2689,7 +2689,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2699,7 +2699,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/ErrorResponseDocument" } @@ -2799,7 +2799,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/DataInResponse" + "$ref": "#/components/schemas/ResourceInResponse" } ] }, @@ -2813,68 +2813,217 @@ }, "additionalProperties": false }, - "AttributesInCreateStaffMemberRequest": { + "AttributesInCreateRequest": { "required": [ - "Name" + "openapi:discriminator" ], "type": "object", "properties": { - "Name": { - "type": "string" - }, - "Age": { - "type": "integer", - "format": "int32" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "StaffMembers": "#/components/schemas/AttributesInCreateStaffMemberRequest", + "Supermarkets": "#/components/schemas/AttributesInCreateSupermarketRequest" } }, + "x-abstract": true + }, + "AttributesInCreateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateRequest" + }, + { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "AttributesInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateRequest" + }, + { + "required": [ + "NameOfCity" + ], + "type": "object", + "properties": { + "NameOfCity": { + "type": "string" + }, + "Kind": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AttributesInResponse": { "required": [ - "NameOfCity" + "openapi:discriminator" ], "type": "object", "properties": { - "NameOfCity": { - "type": "string" - }, - "Kind": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/SupermarketType" + "$ref": "#/components/schemas/ResourceType" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "StaffMembers": "#/components/schemas/AttributesInStaffMemberResponse", + "Supermarkets": "#/components/schemas/AttributesInSupermarketResponse" + } + }, + "x-abstract": true + }, + "AttributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInResponse" + }, + { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "AttributesInUpdateStaffMemberRequest": { - "type": "object", - "properties": { - "Name": { - "type": "string" + "AttributesInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInResponse" }, - "Age": { - "type": "integer", - "format": "int32" + { + "type": "object", + "properties": { + "NameOfCity": { + "type": "string" + }, + "Kind": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketType" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "AttributesInUpdateSupermarketRequest": { + "AttributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "NameOfCity": { - "type": "string" - }, - "Kind": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/SupermarketType" + "$ref": "#/components/schemas/ResourceType" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "StaffMembers": "#/components/schemas/AttributesInUpdateStaffMemberRequest", + "Supermarkets": "#/components/schemas/AttributesInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "AttributesInUpdateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AttributesInUpdateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "NameOfCity": { + "type": "string" + }, + "Kind": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "CreateStaffMemberOperation": { @@ -2988,194 +3137,210 @@ "additionalProperties": false }, "DataInCreateStaffMemberRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/StaffMemberResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/AttributesInCreateStaffMemberRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateStaffMemberRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "DataInCreateSupermarketRequest": { - "required": [ - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/SupermarketResourceType" - } - ] - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/AttributesInCreateSupermarketRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/RelationshipsInCreateSupermarketRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInCreateSupermarketRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "DataInResponse": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/ResourceType" - } - ] + "DataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInResponse" }, - "Meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + } + ] } - ] - } - }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "StaffMembers": "#/components/schemas/StaffMemberDataInResponse", - "Supermarkets": "#/components/schemas/SupermarketDataInResponse" + }, + "additionalProperties": false } - }, - "x-abstract": true - }, - "DataInUpdateStaffMemberRequest": { - "required": [ - "type" ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/StaffMemberResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/AttributesInUpdateStaffMemberRequest" - } - ] + "additionalProperties": false + }, + "DataInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInSupermarketResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInSupermarketResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "DataInUpdateSupermarketRequest": { - "required": [ - "type" - ], + "DataInUpdateStaffMemberRequest": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/SupermarketResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/AttributesInUpdateSupermarketRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInUpdateRequest" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/RelationshipsInUpdateSupermarketRequest" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateStaffMemberRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DataInUpdateSupermarketRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInUpdateSupermarketRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "DeleteStaffMemberOperation": { @@ -3371,6 +3536,37 @@ }, "additionalProperties": false }, + "IdentifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + }, + "Meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/StaffMemberIdentifierInRequest", + "Supermarkets": "#/components/schemas/SupermarketIdentifierInRequest" + } + }, + "x-abstract": true + }, "Jsonapi": { "type": "object", "properties": { @@ -3405,7 +3601,7 @@ "nullable": true } }, - "NullableStaffMemberIdentifierResponseDocument": { + "NullableSecondaryStaffMemberResponseDocument": { "required": [ "data", "links" @@ -3422,18 +3618,24 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" + "$ref": "#/components/schemas/ResourceTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" + "$ref": "#/components/schemas/DataInStaffMemberResponse" } ], "nullable": true }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, "meta": { "allOf": [ { @@ -3444,7 +3646,7 @@ }, "additionalProperties": false }, - "NullableStaffMemberSecondaryResponseDocument": { + "NullableStaffMemberIdentifierResponseDocument": { "required": [ "data", "links" @@ -3461,24 +3663,18 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/ResourceTopLevelLinks" + "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/StaffMemberDataInResponse" + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" } ], "nullable": true }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataInResponse" - } - }, "meta": { "allOf": [ { @@ -3602,6 +3798,94 @@ }, "additionalProperties": false }, + "PrimaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "PrimarySupermarketResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInSupermarketResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, "RelationshipLinks": { "type": "object", "properties": { @@ -3611,64 +3895,184 @@ "related": { "type": "string" } - }, + }, + "additionalProperties": false + }, + "RelationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "Supermarkets": "#/components/schemas/RelationshipsInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "RelationshipsInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInCreateRequest" + }, + { + "required": [ + "StoreManager" + ], + "type": "object", + "properties": { + "StoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/ToOneStaffMemberInRequest" + } + ] + }, + "BackupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/NullableToOneStaffMemberInRequest" + } + ] + }, + "Cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "RelationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "Supermarkets": "#/components/schemas/RelationshipsInSupermarketResponse" + } + }, + "x-abstract": true + }, + "RelationshipsInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInResponse" + }, + { + "type": "object", + "properties": { + "StoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/ToOneStaffMemberInResponse" + } + ] + }, + "BackupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/NullableToOneStaffMemberInResponse" + } + ] + }, + "Cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "RelationshipsInCreateSupermarketRequest": { + "RelationshipsInUpdateRequest": { "required": [ - "StoreManager" + "openapi:discriminator" ], "type": "object", "properties": { - "StoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/ToOneStaffMemberInRequest" - } - ] - }, - "BackupStoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/NullableToOneStaffMemberInRequest" - } - ] - }, - "Cashiers": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + "$ref": "#/components/schemas/ResourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "Supermarkets": "#/components/schemas/RelationshipsInUpdateSupermarketRequest" + } + }, + "x-abstract": true }, "RelationshipsInUpdateSupermarketRequest": { - "type": "object", - "properties": { - "StoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/ToOneStaffMemberInRequest" - } - ] - }, - "BackupStoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/NullableToOneStaffMemberInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInUpdateRequest" }, - "Cashiers": { - "allOf": [ - { - "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + { + "type": "object", + "properties": { + "StoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/ToOneStaffMemberInRequest" + } + ] + }, + "BackupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/NullableToOneStaffMemberInRequest" + } + ] + }, + "Cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "RemoveFromSupermarketCashiersRelationshipOperation": { @@ -3782,81 +4186,20 @@ }, "additionalProperties": false }, - "ResourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "ResourceTopLevelLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "ResourceType": { - "enum": [ - "StaffMembers", - "Supermarkets" - ], - "type": "string" - }, - "StaffMemberAttributesInResponse": { - "type": "object", - "properties": { - "Name": { - "type": "string" - }, - "Age": { - "type": "integer", - "format": "int32" - } - }, - "additionalProperties": false - }, - "StaffMemberCollectionResponseDocument": { + "ResourceInCreateRequest": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/Jsonapi" - } - ] - }, - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/ResourceCollectionTopLevelLinks" + "$ref": "#/components/schemas/ResourceType" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/StaffMemberDataInResponse" - } - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataInResponse" - } - }, - "meta": { + "Meta": { "allOf": [ { "$ref": "#/components/schemas/Meta" @@ -3864,72 +4207,30 @@ ] } }, - "additionalProperties": false - }, - "StaffMemberDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/DataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/StaffMemberAttributesInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/ResourceLinks" - } - ] - } - }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/DataInCreateStaffMemberRequest", + "Supermarkets": "#/components/schemas/DataInCreateSupermarketRequest" } - ], - "additionalProperties": false + }, + "x-abstract": true }, - "StaffMemberIdentifierCollectionResponseDocument": { + "ResourceInResponse": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/Jsonapi" - } - ] - }, - "links": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/ResourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/ResourceType" } ] }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" - } - }, - "meta": { + "Meta": { "allOf": [ { "$ref": "#/components/schemas/Meta" @@ -3937,9 +4238,17 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/DataInStaffMemberResponse", + "Supermarkets": "#/components/schemas/DataInSupermarketResponse" + } + }, + "x-abstract": true }, - "StaffMemberIdentifierInRequest": { + "ResourceInUpdateRequest": { "required": [ "type" ], @@ -3948,20 +4257,11 @@ "type": { "allOf": [ { - "$ref": "#/components/schemas/StaffMemberResourceType" + "$ref": "#/components/schemas/ResourceType" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "meta": { + "Meta": { "allOf": [ { "$ref": "#/components/schemas/Meta" @@ -3969,26 +4269,77 @@ ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/DataInUpdateStaffMemberRequest", + "Supermarkets": "#/components/schemas/DataInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "ResourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, "additionalProperties": false }, - "StaffMemberIdentifierInResponse": { + "ResourceType": { + "enum": [ + "StaffMembers", + "Supermarkets" + ], + "type": "string" + }, + "SecondaryStaffMemberResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "jsonapi": { "allOf": [ { - "$ref": "#/components/schemas/StaffMemberResourceType" + "$ref": "#/components/schemas/Jsonapi" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } }, "meta": { "allOf": [ @@ -4000,7 +4351,7 @@ }, "additionalProperties": false }, - "StaffMemberIdentifierResponseDocument": { + "StaffMemberCollectionResponseDocument": { "required": [ "data", "links" @@ -4017,16 +4368,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" + "$ref": "#/components/schemas/ResourceCollectionTopLevelLinks" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/DataInStaffMemberResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } }, "meta": { "allOf": [ @@ -4038,7 +4394,7 @@ }, "additionalProperties": false }, - "StaffMemberPrimaryResponseDocument": { + "StaffMemberIdentifierCollectionResponseDocument": { "required": [ "data", "links" @@ -4055,21 +4411,14 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/ResourceTopLevelLinks" + "$ref": "#/components/schemas/ResourceIdentifierCollectionTopLevelLinks" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/StaffMemberDataInResponse" - } - ] - }, - "included": { "type": "array", "items": { - "$ref": "#/components/schemas/DataInResponse" + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" } }, "meta": { @@ -4082,13 +4431,60 @@ }, "additionalProperties": false }, - "StaffMemberResourceType": { - "enum": [ - "StaffMembers" + "StaffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/IdentifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } ], - "type": "string" + "additionalProperties": false + }, + "StaffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false }, - "StaffMemberSecondaryResponseDocument": { + "StaffMemberIdentifierResponseDocument": { "required": [ "data", "links" @@ -4105,23 +4501,17 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/ResourceTopLevelLinks" + "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/StaffMemberDataInResponse" + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataInResponse" - } - }, "meta": { "allOf": [ { @@ -4132,21 +4522,11 @@ }, "additionalProperties": false }, - "SupermarketAttributesInResponse": { - "type": "object", - "properties": { - "NameOfCity": { - "type": "string" - }, - "Kind": { - "allOf": [ - { - "$ref": "#/components/schemas/SupermarketType" - } - ] - } - }, - "additionalProperties": false + "StaffMemberResourceType": { + "enum": [ + "StaffMembers" + ], + "type": "string" }, "SupermarketBackupStoreManagerRelationshipIdentifier": { "required": [ @@ -4250,13 +4630,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/SupermarketDataInResponse" + "$ref": "#/components/schemas/DataInSupermarketResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/DataInResponse" + "$ref": "#/components/schemas/ResourceInResponse" } }, "meta": { @@ -4269,15 +4649,13 @@ }, "additionalProperties": false }, - "SupermarketDataInResponse": { + "SupermarketIdentifierInRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/DataInResponse" + "$ref": "#/components/schemas/IdentifierInRequest" }, { - "required": [ - "id" - ], "type": "object", "properties": { "id": { @@ -4285,26 +4663,9 @@ "type": "string", "format": "int32" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/SupermarketAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/SupermarketRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/ResourceLinks" - } - ] + "lid": { + "minLength": 1, + "type": "string" } }, "additionalProperties": false @@ -4312,109 +4673,6 @@ ], "additionalProperties": false }, - "SupermarketIdentifierInRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/SupermarketResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "lid": { - "minLength": 1, - "type": "string" - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" - } - ] - } - }, - "additionalProperties": false - }, - "SupermarketPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "jsonapi": { - "allOf": [ - { - "$ref": "#/components/schemas/Jsonapi" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/ResourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/SupermarketDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" - } - ] - } - }, - "additionalProperties": false - }, - "SupermarketRelationshipsInResponse": { - "type": "object", - "properties": { - "StoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/ToOneStaffMemberInResponse" - } - ] - }, - "BackupStoreManager": { - "allOf": [ - { - "$ref": "#/components/schemas/NullableToOneStaffMemberInResponse" - } - ] - }, - "Cashiers": { - "allOf": [ - { - "$ref": "#/components/schemas/ToManyStaffMemberInResponse" - } - ] - } - }, - "additionalProperties": false - }, "SupermarketResourceType": { "enum": [ "Supermarkets" diff --git a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs index c50c8a9e6c..5cb95663d5 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs @@ -6,6 +6,9 @@ namespace OpenApiTests.NamingConventions.PascalCase; public sealed class PascalCaseTests : IClassFixture, NamingConventionDbContext>> { + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; + private readonly OpenApiTestContext, NamingConventionDbContext> _testContext; public PascalCaseTests(OpenApiTestContext, NamingConventionDbContext> testContext) @@ -35,7 +38,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() operationElement.Should().Be("GetSupermarketCollection"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("SupermarketCollectionResponseDocument").SchemaReferenceId; }); @@ -51,7 +54,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") .ShouldBeSchemaReferenceId("ResourceCollectionTopLevelLinks").SchemaReferenceId; - resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("SupermarketDataInResponse") + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("DataInSupermarketResponse") .SchemaReferenceId; }); @@ -70,12 +73,12 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() string? resourceRelationshipInResponseSchemaRefId = null; string abstractResourceDataSchemaRefId = schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[0].$ref") - .ShouldBeSchemaReferenceId("DataInResponse").SchemaReferenceId; + .ShouldBeSchemaReferenceId("ResourceInResponse").SchemaReferenceId; schemasElement.Should().ContainPath($"{abstractResourceDataSchemaRefId}.discriminator.mapping").With(mappingElement => { - mappingElement.Should().ContainPath("Supermarkets").ShouldBeSchemaReferenceId("SupermarketDataInResponse"); - mappingElement.Should().ContainPath("StaffMembers").ShouldBeSchemaReferenceId("StaffMemberDataInResponse"); + mappingElement.Should().ContainPath("Supermarkets").ShouldBeSchemaReferenceId("DataInSupermarketResponse"); + mappingElement.Should().ContainPath("StaffMembers").ShouldBeSchemaReferenceId("DataInStaffMemberResponse"); }); schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => @@ -84,10 +87,10 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() .SchemaReferenceId; resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") - .ShouldBeSchemaReferenceId("SupermarketAttributesInResponse").SchemaReferenceId; + .ShouldBeSchemaReferenceId("AttributesInSupermarketResponse").SchemaReferenceId; resourceRelationshipInResponseSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") - .ShouldBeSchemaReferenceId("SupermarketRelationshipsInResponse").SchemaReferenceId; + .ShouldBeSchemaReferenceId("RelationshipsInSupermarketResponse").SchemaReferenceId; }); schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => @@ -95,7 +98,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainProperty("self"); }); - schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("NameOfCity"); propertiesElement.Should().ContainProperty("Kind"); @@ -104,7 +107,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() string? nullableToOneResourceResponseDataSchemaRefId = null; - schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("StoreManager"); @@ -166,8 +169,8 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() operationElement.Should().Be("GetSupermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("SupermarketPrimaryResponseDocument").SchemaReferenceId; + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("PrimarySupermarketResponseDocument").SchemaReferenceId; }); document.Should().ContainPath("components.schemas").With(schemasElement => @@ -204,8 +207,8 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin operationElement.Should().Be("GetSupermarketStoreManager"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("StaffMemberSecondaryResponseDocument").SchemaReferenceId; + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("SecondaryStaffMemberResponseDocument").SchemaReferenceId; }); document.Should().ContainPath("components.schemas").With(schemasElement => @@ -214,13 +217,13 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_sin schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("StaffMemberDataInResponse") + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("DataInStaffMemberResponse") .SchemaReferenceId; }); schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { - propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("StaffMemberAttributesInResponse"); + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("AttributesInStaffMemberResponse"); }); }); } @@ -239,8 +242,8 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nul operationElement.Should().Be("GetSupermarketBackupStoreManager"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") - .ShouldBeSchemaReferenceId("NullableStaffMemberSecondaryResponseDocument"); + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("NullableSecondaryStaffMemberResponseDocument"); }); } @@ -258,7 +261,7 @@ public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_res operationElement.Should().Be("GetSupermarketCashiers"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("StaffMemberCollectionResponseDocument"); }); } @@ -279,7 +282,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("GetSupermarketStoreManagerRelationship"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("StaffMemberIdentifierResponseDocument").SchemaReferenceId; }); @@ -316,7 +319,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("GetSupermarketBackupStoreManagerRelationship"); }); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("NullableStaffMemberIdentifierResponseDocument"); }); } @@ -337,7 +340,7 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ operationElement.Should().Be("GetSupermarketCashiersRelationship"); }); - documentSchemaRefId = getElement.Should().ContainPath("responses.200.content['application/vnd.api+json'].schema.$ref") + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("StaffMemberIdentifierCollectionResponseDocument").SchemaReferenceId; }); @@ -380,7 +383,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() operationElement.Should().Be("PostSupermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("requestBody.content['application/vnd.api+json'].schema.allOf[0].$ref") + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("CreateSupermarketRequestDocument").SchemaReferenceId; }); @@ -396,7 +399,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() string? resourceRelationshipInPostRequestSchemaRefId = null; - schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("AttributesInCreateSupermarketRequest"); @@ -404,7 +407,7 @@ public async Task Casing_convention_is_applied_to_Post_endpoint() .ShouldBeSchemaReferenceId("RelationshipsInCreateSupermarketRequest").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("StoreManager"); propertiesElement.Should().ContainPath("StoreManager.allOf[0].$ref").ShouldBeSchemaReferenceId("ToOneStaffMemberInRequest"); @@ -450,7 +453,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() operationElement.Should().Be("PatchSupermarket"); }); - documentSchemaRefId = getElement.Should().ContainPath("requestBody.content['application/vnd.api+json'].schema.allOf[0].$ref") + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("UpdateSupermarketRequestDocument").SchemaReferenceId; }); @@ -464,7 +467,7 @@ public async Task Casing_convention_is_applied_to_Patch_endpoint() .ShouldBeSchemaReferenceId("DataInUpdateSupermarketRequest").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("AttributesInUpdateSupermarketRequest"); propertiesElement.Should().ContainPath("relationships.allOf[0].$ref").ShouldBeSchemaReferenceId("RelationshipsInUpdateSupermarketRequest"); @@ -566,10 +569,10 @@ public async Task Casing_convention_is_applied_to_PostOperations_endpoint() operationElement.Should().Be("PostOperations"); }); - getElement.Should().ContainPath("requestBody.content['application/vnd.api+json; ext=atomic'].schema.allOf[0].$ref") + getElement.Should().ContainPath($"requestBody.content{EscapedOperationsMediaType}.schema.allOf[0].$ref") .ShouldBeSchemaReferenceId("OperationsRequestDocument"); - getElement.Should().ContainPath("responses.200.content['application/vnd.api+json; ext=atomic'].schema.$ref") + getElement.Should().ContainPath($"responses.200.content{EscapedOperationsMediaType}.schema.$ref") .ShouldBeSchemaReferenceId("OperationsResponseDocument"); }); diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json index ff4b8e0b28..4b5473246c 100644 --- a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nameValuePairCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the nameValuePair to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nameValuePairPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryNameValuePairResponseDocument" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -319,9 +319,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nameValuePairPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryNameValuePairResponseDocument" } } } @@ -341,7 +341,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -351,7 +351,7 @@ "404": { "description": "The nameValuePair does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -477,7 +477,7 @@ "requestBody": { "description": "The attributes and relationships of the nameValuePair to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -493,9 +493,9 @@ "200": { "description": "The nameValuePair was successfully updated, which resulted in additional changes. The updated nameValuePair is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nameValuePairPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryNameValuePairResponseDocument" } } } @@ -506,7 +506,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -516,7 +516,7 @@ "404": { "description": "The nameValuePair or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -526,7 +526,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -536,7 +536,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -571,7 +571,7 @@ "404": { "description": "The nameValuePair does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -635,9 +635,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nodeSecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryNodeResponseDocument" } } } @@ -657,7 +657,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -667,7 +667,7 @@ "404": { "description": "The nameValuePair does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -813,7 +813,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nodeIdentifierResponseDocument" } @@ -835,7 +835,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -845,7 +845,7 @@ "404": { "description": "The nameValuePair does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -958,7 +958,7 @@ "requestBody": { "description": "The identity of the node to assign to the owner relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -977,7 +977,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -987,7 +987,7 @@ "404": { "description": "The nameValuePair or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -997,7 +997,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1007,7 +1007,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1060,7 +1060,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nodeCollectionResponseDocument" } @@ -1082,7 +1082,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1183,7 +1183,7 @@ "requestBody": { "description": "The attributes and relationships of the node to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1209,9 +1209,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nodePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryNodeResponseDocument" } } } @@ -1222,7 +1222,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1232,7 +1232,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1242,7 +1242,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1252,7 +1252,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1262,7 +1262,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1326,9 +1326,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nodePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryNodeResponseDocument" } } } @@ -1348,7 +1348,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1358,7 +1358,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1484,7 +1484,7 @@ "requestBody": { "description": "The attributes and relationships of the node to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1500,9 +1500,9 @@ "200": { "description": "The node was successfully updated, which resulted in additional changes. The updated node is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nodePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryNodeResponseDocument" } } } @@ -1513,7 +1513,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1523,7 +1523,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1533,7 +1533,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1543,7 +1543,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1578,7 +1578,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1642,7 +1642,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nodeCollectionResponseDocument" } @@ -1664,7 +1664,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1674,7 +1674,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1820,7 +1820,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nodeIdentifierCollectionResponseDocument" } @@ -1842,7 +1842,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1852,7 +1852,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1965,7 +1965,7 @@ "requestBody": { "description": "The identities of the nodes to add to the children relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1984,7 +1984,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1994,7 +1994,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2004,7 +2004,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2014,7 +2014,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2045,7 +2045,7 @@ "requestBody": { "description": "The identities of the nodes to assign to the children relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2064,7 +2064,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2074,7 +2074,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2084,7 +2084,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2094,7 +2094,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2125,7 +2125,7 @@ "requestBody": { "description": "The identities of the nodes to remove from the children relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2144,7 +2144,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2154,7 +2154,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2164,7 +2164,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2174,7 +2174,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2238,9 +2238,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableNodeSecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryNodeResponseDocument" } } } @@ -2260,7 +2260,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2270,7 +2270,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2416,7 +2416,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableNodeIdentifierResponseDocument" } @@ -2438,7 +2438,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2448,7 +2448,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2561,7 +2561,7 @@ "requestBody": { "description": "The identity of the node to assign to the parent relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2580,7 +2580,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2590,7 +2590,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2600,7 +2600,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2610,7 +2610,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2674,7 +2674,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nameValuePairCollectionResponseDocument" } @@ -2696,7 +2696,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2706,7 +2706,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2852,7 +2852,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nameValuePairIdentifierCollectionResponseDocument" } @@ -2874,7 +2874,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2884,7 +2884,7 @@ "404": { "description": "The node does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2997,7 +2997,7 @@ "requestBody": { "description": "The identities of the nameValuePairs to add to the values relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3016,7 +3016,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3026,7 +3026,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3036,7 +3036,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3046,7 +3046,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3077,7 +3077,7 @@ "requestBody": { "description": "The identities of the nameValuePairs to assign to the values relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3096,7 +3096,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3106,7 +3106,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3116,7 +3116,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3126,7 +3126,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3157,7 +3157,7 @@ "requestBody": { "description": "The identities of the nameValuePairs to remove from the values relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3176,7 +3176,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3186,7 +3186,7 @@ "404": { "description": "The node or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3196,7 +3196,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3206,7 +3206,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3220,170 +3220,219 @@ "components": { "schemas": { "attributesInCreateNameValuePairRequest": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "value": { - "type": "string", - "nullable": true + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "attributesInCreateNodeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { "required": [ - "name" + "openapi:discriminator" ], "type": "object", "properties": { - "name": { - "type": "string" - }, - "comment": { - "type": "string", - "nullable": true + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/attributesInCreateNameValuePairRequest", + "nodes": "#/components/schemas/attributesInCreateNodeRequest" + } + }, + "x-abstract": true }, - "attributesInUpdateNameValuePairRequest": { - "type": "object", - "properties": { - "name": { - "type": "string" + "attributesInNameValuePairResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "value": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "attributesInUpdateNodeRequest": { - "type": "object", - "properties": { - "name": { - "type": "string" + "attributesInNodeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "comment": { - "type": "string", - "nullable": true + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createNameValuePairRequestDocument": { + "attributesInResponse": { "required": [ - "data" + "openapi:discriminator" ], "type": "object", "properties": { - "data": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/dataInCreateNameValuePairRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/attributesInNameValuePairResponse", + "nodes": "#/components/schemas/attributesInNodeResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateNameValuePairRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createNodeRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateNodeRequest" - } - ] + "attributesInUpdateNodeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateNameValuePairRequest": { + "attributesInUpdateRequest": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/nameValuePairResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateNameValuePairRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateNameValuePairRequest" - } - ] - }, - "meta": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/attributesInUpdateNameValuePairRequest", + "nodes": "#/components/schemas/attributesInUpdateNodeRequest" + } + }, + "x-abstract": true }, - "dataInCreateNodeRequest": { + "createNameValuePairRequestDocument": { "required": [ - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/nodeResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateNodeRequest" - } - ] - }, - "relationships": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInCreateNodeRequest" + "$ref": "#/components/schemas/dataInCreateNameValuePairRequest" } ] }, @@ -3397,16 +3446,16 @@ }, "additionalProperties": false }, - "dataInResponse": { + "createNodeRequestDocument": { "required": [ - "type" + "data" ], "type": "object", "properties": { - "type": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/resourceType" + "$ref": "#/components/schemas/dataInCreateNodeRequest" } ] }, @@ -3418,100 +3467,224 @@ ] } }, - "additionalProperties": false, - "discriminator": { - "propertyName": "type", - "mapping": { - "nameValuePairs": "#/components/schemas/nameValuePairDataInResponse", - "nodes": "#/components/schemas/nodeDataInResponse" - } - }, - "x-abstract": true + "additionalProperties": false }, - "dataInUpdateNameValuePairRequest": { - "required": [ - "id", - "type" - ], + "dataInCreateNameValuePairRequest": { "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/nameValuePairResourceType" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateNameValuePairRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateNameValuePairRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateNodeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateNodeRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateNodeRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInNameValuePairResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateNameValuePairRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInNameValuePairResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInNameValuePairResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInNodeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateNameValuePairRequest" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInNodeResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInNodeResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateNameValuePairRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateNameValuePairRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateNameValuePairRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "dataInUpdateNodeRequest": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/nodeResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateNodeRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInUpdateNodeRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateNodeRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateNodeRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "errorLinks": { @@ -3636,24 +3809,42 @@ }, "additionalProperties": false }, - "meta": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "nameValuePairAttributesInResponse": { + "identifierInRequest": { + "required": [ + "type" + ], "type": "object", "properties": { - "name": { - "type": "string" + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, - "value": { - "type": "string", - "nullable": true + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/nameValuePairIdentifierInRequest", + "nodes": "#/components/schemas/nodeIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } }, "nameValuePairCollectionResponseDocument": { "required": [ @@ -3672,13 +3863,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/nameValuePairDataInResponse" + "$ref": "#/components/schemas/dataInNameValuePairResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3691,49 +3882,6 @@ }, "additionalProperties": false }, - "nameValuePairDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/nameValuePairAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/nameValuePairRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "nameValuePairIdentifierCollectionResponseDocument": { "required": [ "data", @@ -3765,32 +3913,26 @@ "additionalProperties": false }, "nameValuePairIdentifierInRequest": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/nameValuePairResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "nameValuePairIdentifierInResponse": { @@ -3822,75 +3964,12 @@ }, "additionalProperties": false }, - "nameValuePairPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/nameValuePairDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "nameValuePairRelationshipsInResponse": { - "type": "object", - "properties": { - "owner": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneNodeInResponse" - } - ] - } - }, - "additionalProperties": false - }, "nameValuePairResourceType": { "enum": [ "nameValuePairs" ], "type": "string" }, - "nodeAttributesInResponse": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "comment": { - "type": "string", - "nullable": true - } - }, - "additionalProperties": false - }, "nodeCollectionResponseDocument": { "required": [ "data", @@ -3908,13 +3987,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/nodeDataInResponse" + "$ref": "#/components/schemas/dataInNodeResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3927,49 +4006,6 @@ }, "additionalProperties": false }, - "nodeDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/nodeAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/nodeRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "nodeIdentifierCollectionResponseDocument": { "required": [ "data", @@ -4001,32 +4037,26 @@ "additionalProperties": false }, "nodeIdentifierInRequest": { - "required": [ - "id", - "type" - ], "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/nodeResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "nodeIdentifierInResponse": { @@ -4089,7 +4119,13 @@ }, "additionalProperties": false }, - "nodePrimaryResponseDocument": { + "nodeResourceType": { + "enum": [ + "nodes" + ], + "type": "string" + }, + "nullableNodeIdentifierResponseDocument": { "required": [ "data", "links" @@ -4099,22 +4135,17 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/nodeDataInResponse" + "$ref": "#/components/schemas/nodeIdentifierInResponse" } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + ], + "nullable": true }, "meta": { "allOf": [ @@ -4126,65 +4157,57 @@ }, "additionalProperties": false }, - "nodeRelationshipsInResponse": { + "nullableSecondaryNodeResponseDocument": { + "required": [ + "data", + "links" + ], "type": "object", "properties": { - "values": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/toManyNameValuePairInResponse" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, - "parent": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneNodeInResponse" + "$ref": "#/components/schemas/dataInNodeResponse" } - ] + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, - "children": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyNodeInResponse" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false }, - "nodeResourceType": { - "enum": [ - "nodes" - ], - "type": "string" - }, - "nodeSecondaryResponseDocument": { + "nullableToOneNodeInRequest": { "required": [ - "data", - "links" + "data" ], "type": "object", "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, "data": { "allOf": [ { - "$ref": "#/components/schemas/nodeDataInResponse" + "$ref": "#/components/schemas/nodeIdentifierInRequest" } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + ], + "nullable": true }, "meta": { "allOf": [ @@ -4196,17 +4219,13 @@ }, "additionalProperties": false }, - "nullableNodeIdentifierResponseDocument": { - "required": [ - "data", - "links" - ], + "nullableToOneNodeInResponse": { "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -4228,7 +4247,7 @@ }, "additionalProperties": false }, - "nullableNodeSecondaryResponseDocument": { + "primaryNameValuePairResponseDocument": { "required": [ "data", "links" @@ -4245,15 +4264,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/nodeDataInResponse" + "$ref": "#/components/schemas/dataInNameValuePairResponse" } - ], - "nullable": true + ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4266,47 +4284,32 @@ }, "additionalProperties": false }, - "nullableToOneNodeInRequest": { + "primaryNodeResponseDocument": { "required": [ - "data" + "data", + "links" ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/nodeIdentifierInRequest" - } - ], - "nullable": true - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "nullableToOneNodeInResponse": { "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/relationshipLinks" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/nodeIdentifierInResponse" + "$ref": "#/components/schemas/dataInNodeResponse" } - ], - "nullable": true + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, "meta": { "allOf": [ @@ -4330,88 +4333,248 @@ }, "additionalProperties": false }, - "relationshipsInCreateNameValuePairRequest": { + "relationshipsInCreateNameValuePairRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "owner" + ], + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneNodeInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateNodeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "values": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInRequest" + } + ] + }, + "parent": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneNodeInRequest" + } + ] + }, + "children": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { "required": [ - "owner" + "openapi:discriminator" ], "type": "object", "properties": { - "owner": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneNodeInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/relationshipsInCreateNameValuePairRequest", + "nodes": "#/components/schemas/relationshipsInCreateNodeRequest" + } + }, + "x-abstract": true }, - "relationshipsInCreateNodeRequest": { - "type": "object", - "properties": { - "values": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyNameValuePairInRequest" - } - ] + "relationshipsInNameValuePairResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "parent": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneNodeInRequest" + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneNodeInResponse" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInNodeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "children": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyNodeInRequest" + { + "type": "object", + "properties": { + "values": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInResponse" + } + ] + }, + "parent": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneNodeInResponse" + } + ] + }, + "children": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInResponse" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "relationshipsInUpdateNameValuePairRequest": { + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "owner": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneNodeInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/relationshipsInNameValuePairResponse", + "nodes": "#/components/schemas/relationshipsInNodeResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateNameValuePairRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneNodeInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, "relationshipsInUpdateNodeRequest": { - "type": "object", - "properties": { - "values": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyNameValuePairInRequest" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "parent": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneNodeInRequest" + { + "type": "object", + "properties": { + "values": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInRequest" + } + ] + }, + "parent": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneNodeInRequest" + } + ] + }, + "children": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInRequest" + } + ] } - ] - }, - "children": { + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyNodeInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/relationshipsInUpdateNameValuePairRequest", + "nodes": "#/components/schemas/relationshipsInUpdateNodeRequest" + } + }, + "x-abstract": true }, "resourceCollectionTopLevelLinks": { "type": "object", @@ -4479,6 +4642,99 @@ }, "additionalProperties": false }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/dataInCreateNameValuePairRequest", + "nodes": "#/components/schemas/dataInCreateNodeRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/dataInNameValuePairResponse", + "nodes": "#/components/schemas/dataInNodeResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/dataInUpdateNameValuePairRequest", + "nodes": "#/components/schemas/dataInUpdateNodeRequest" + } + }, + "x-abstract": true + }, "resourceLinks": { "type": "object", "properties": { @@ -4507,6 +4763,43 @@ ], "type": "string" }, + "secondaryNodeResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInNodeResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "toManyNameValuePairInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/QueryStrings/IncludeTests.cs b/test/OpenApiTests/QueryStrings/IncludeTests.cs index aa7c6d42aa..e35ab21621 100644 --- a/test/OpenApiTests/QueryStrings/IncludeTests.cs +++ b/test/OpenApiTests/QueryStrings/IncludeTests.cs @@ -38,7 +38,7 @@ public async Task Discriminator_is_generated_for_all_resource_types_when_subset_ { List discriminatorRefIds = []; - schemasElement.Should().ContainPath("dataInResponse.discriminator").With(discriminatorElement => + schemasElement.Should().ContainPath("resourceInResponse.discriminator").With(discriminatorElement => { discriminatorElement.Should().HaveProperty("propertyName", "type"); @@ -56,7 +56,7 @@ public async Task Discriminator_is_generated_for_all_resource_types_when_subset_ foreach (string discriminatorRefId in discriminatorRefIds) { - schemasElement.Should().ContainPath($"{discriminatorRefId}.allOf[0].$ref").ShouldBeSchemaReferenceId("dataInResponse"); + schemasElement.Should().ContainPath($"{discriminatorRefId}.allOf[0].$ref").ShouldBeSchemaReferenceId("resourceInResponse"); } }); } diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 13433002ba..541a5901ba 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/resourceCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -319,9 +319,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -341,7 +341,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -351,7 +351,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -477,7 +477,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -493,9 +493,9 @@ "200": { "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -506,7 +506,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -516,7 +516,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -526,7 +526,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -536,7 +536,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -571,7 +571,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -635,7 +635,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -657,7 +657,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -667,7 +667,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -813,7 +813,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -835,7 +835,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -845,7 +845,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -958,7 +958,7 @@ "requestBody": { "description": "The identities of the empties to add to the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -977,7 +977,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -987,7 +987,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -997,7 +997,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1007,7 +1007,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1038,7 +1038,7 @@ "requestBody": { "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1057,7 +1057,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1067,7 +1067,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1077,7 +1077,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1087,7 +1087,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1118,7 +1118,7 @@ "requestBody": { "description": "The identities of the empties to remove from the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1137,7 +1137,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1147,7 +1147,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1157,7 +1157,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1167,7 +1167,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1231,9 +1231,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableEmptySecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" } } } @@ -1253,7 +1253,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1263,7 +1263,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1409,7 +1409,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" } @@ -1431,7 +1431,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1441,7 +1441,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1554,7 +1554,7 @@ "requestBody": { "description": "The identity of the empty to assign to the requiredToOne relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1573,7 +1573,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1583,7 +1583,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1593,7 +1593,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1603,7 +1603,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1667,7 +1667,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -1689,7 +1689,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1699,7 +1699,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1845,7 +1845,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -1867,7 +1867,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1877,7 +1877,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1990,7 +1990,7 @@ "requestBody": { "description": "The identities of the empties to add to the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2009,7 +2009,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2019,7 +2019,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2029,7 +2029,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2039,7 +2039,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2070,7 +2070,7 @@ "requestBody": { "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2089,7 +2089,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2099,7 +2099,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2109,7 +2109,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2119,7 +2119,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2150,7 +2150,7 @@ "requestBody": { "description": "The identities of the empties to remove from the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2169,7 +2169,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2179,7 +2179,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2189,7 +2189,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2199,7 +2199,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2263,9 +2263,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableEmptySecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" } } } @@ -2285,7 +2285,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2295,7 +2295,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2441,7 +2441,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" } @@ -2463,7 +2463,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2473,7 +2473,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2586,7 +2586,7 @@ "requestBody": { "description": "The identity of the empty to assign to the toOne relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2605,7 +2605,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2615,7 +2615,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2625,7 +2625,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2635,7 +2635,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2648,198 +2648,213 @@ }, "components": { "schemas": { - "attributesInCreateResourceRequest": { + "attributesInCreateRequest": { "required": [ - "requiredNullableValueType", - "requiredReferenceType", - "requiredValueType" + "openapi:discriminator" ], "type": "object", "properties": { - "referenceType": { - "type": "string", - "nullable": true - }, - "requiredReferenceType": { - "minLength": 1, - "type": "string", - "nullable": true - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true }, - "attributesInUpdateResourceRequest": { - "type": "object", - "properties": { - "referenceType": { - "type": "string", - "nullable": true - }, - "requiredReferenceType": { - "minLength": 1, - "type": "string", - "nullable": true - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + { + "required": [ + "requiredNullableValueType", + "requiredReferenceType", + "requiredValueType" + ], + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createResourceRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateResourceRequest" - } - ] + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateResourceRequest": { + "attributesInResponse": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateResourceRequest" - } - ] - }, - "relationships": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true }, - "dataInResponse": { + "attributesInUpdateRequest": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { "$ref": "#/components/schemas/resourceType" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false, "discriminator": { - "propertyName": "type", + "propertyName": "openapi:discriminator", "mapping": { - "empties": "#/components/schemas/emptyDataInResponse", - "resources": "#/components/schemas/resourceDataInResponse" + "resources": "#/components/schemas/attributesInUpdateResourceRequest" } }, "x-abstract": true }, - "dataInUpdateResourceRequest": { + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { "required": [ - "id", - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateResourceRequest" - } - ] - }, - "relationships": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] }, @@ -2853,46 +2868,112 @@ }, "additionalProperties": false }, - "emptyCollectionResponseDocument": { - "required": [ - "data", - "links" - ], + "dataInCreateResourceRequest": { "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/emptyDataInResponse" - } + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "emptyDataInResponse": { + "dataInUpdateResourceRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInUpdateRequest" }, { "required": [ @@ -2905,10 +2986,17 @@ "type": "string", "format": "int32" }, - "links": { + "attributes": { "allOf": [ { - "$ref": "#/components/schemas/resourceLinks" + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" } ] } @@ -2918,7 +3006,7 @@ ], "additionalProperties": false }, - "emptyIdentifierCollectionResponseDocument": { + "emptyCollectionResponseDocument": { "required": [ "data", "links" @@ -2928,14 +3016,20 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, "data": { "type": "array", "items": { - "$ref": "#/components/schemas/emptyIdentifierInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -2948,24 +3042,25 @@ }, "additionalProperties": false }, - "emptyIdentifierInRequest": { + "emptyIdentifierCollectionResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/emptyResourceType" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } }, "meta": { "allOf": [ @@ -2977,6 +3072,29 @@ }, "additionalProperties": false }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "emptyIdentifierInResponse": { "required": [ "id", @@ -3134,6 +3252,36 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, "meta": { "type": "object", "additionalProperties": { @@ -3172,7 +3320,7 @@ }, "additionalProperties": false }, - "nullableEmptySecondaryResponseDocument": { + "nullableSecondaryEmptyResponseDocument": { "required": [ "data", "links" @@ -3189,7 +3337,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/emptyDataInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" } ], "nullable": true @@ -3197,7 +3345,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3231,152 +3379,283 @@ } ] } - }, + }, + "additionalProperties": false + }, + "nullableToOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryResourceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResourceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "requiredToMany", + "requiredToOne" + ], + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "nullableToOneEmptyInResponse": { + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/emptyIdentifierInResponse" - } - ], - "nullable": true - }, - "meta": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false - }, - "relationshipLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "related": { - "type": "string" + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" } }, - "additionalProperties": false + "x-abstract": true }, - "relationshipsInCreateResourceRequest": { + "relationshipsInUpdateRequest": { "required": [ - "requiredToMany", - "requiredToOne" + "openapi:discriminator" ], "type": "object", "properties": { - "toOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" - } - ] - }, - "requiredToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" - } - ] - }, - "toMany": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEmptyInRequest" - } - ] - }, - "requiredToMany": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false - }, - "relationshipsInUpdateResourceRequest": { - "type": "object", - "properties": { - "toOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" - } - ] - }, - "requiredToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" - } - ] - }, - "toMany": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEmptyInRequest" - } - ] - }, - "requiredToMany": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEmptyInRequest" - } - ] + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" } }, - "additionalProperties": false + "x-abstract": true }, - "resourceAttributesInResponse": { - "type": "object", - "properties": { - "referenceType": { - "type": "string", - "nullable": true - }, - "requiredReferenceType": { - "minLength": 1, - "type": "string", - "nullable": true - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "resourceCollectionResponseDocument": { @@ -3396,13 +3675,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/dataInResourceResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3439,49 +3718,6 @@ }, "additionalProperties": false }, - "resourceDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "resourceIdentifierCollectionTopLevelLinks": { "type": "object", "properties": { @@ -3524,42 +3760,19 @@ }, "additionalProperties": false }, - "resourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourcePrimaryResponseDocument": { + "resourceInCreateRequest": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -3568,47 +3781,84 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true }, - "resourceRelationshipsInResponse": { + "resourceInResponse": { + "required": [ + "type" + ], "type": "object", "properties": { - "toOne": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredToOne": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] - }, - "toMany": { + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredToMany": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true }, - "resourceResourceType": { - "enum": [ - "resources" - ], - "type": "string" + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false }, "resourceTopLevelLinks": { "type": "object", diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs index 41c174770d..fb73500b5f 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs @@ -28,7 +28,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -46,7 +46,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -64,7 +64,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { @@ -85,7 +85,7 @@ public async Task Schema_property_for_relationship_is_not_nullable(string jsonPr JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs index 075801fba8..3d8bc4542c 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs @@ -25,7 +25,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -42,7 +42,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -58,7 +58,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -74,7 +74,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -88,7 +88,10 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceAttributesInPatchRequest.required"); + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); } [Fact] @@ -98,6 +101,9 @@ public async Task No_relationship_schema_properties_are_required_for_updating_re JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceRelationshipsInPatchRequest.required"); + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); } } diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 1dee75173f..cb83b19b17 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/resourceCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -319,9 +319,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -341,7 +341,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -351,7 +351,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -477,7 +477,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -493,9 +493,9 @@ "200": { "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -506,7 +506,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -516,7 +516,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -526,7 +526,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -536,7 +536,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -571,7 +571,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -635,7 +635,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -657,7 +657,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -667,7 +667,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -813,7 +813,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -835,7 +835,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -845,7 +845,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -958,7 +958,7 @@ "requestBody": { "description": "The identities of the empties to add to the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -977,7 +977,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -987,7 +987,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -997,7 +997,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1007,7 +1007,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1038,7 +1038,7 @@ "requestBody": { "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1057,7 +1057,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1067,7 +1067,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1077,7 +1077,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1087,7 +1087,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1118,7 +1118,7 @@ "requestBody": { "description": "The identities of the empties to remove from the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1137,7 +1137,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1147,7 +1147,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1157,7 +1157,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1167,7 +1167,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1231,9 +1231,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/emptySecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" } } } @@ -1253,7 +1253,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1263,7 +1263,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1409,7 +1409,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierResponseDocument" } @@ -1431,7 +1431,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1441,7 +1441,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1554,7 +1554,7 @@ "requestBody": { "description": "The identity of the empty to assign to the requiredToOne relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1573,7 +1573,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1583,7 +1583,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1593,7 +1593,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1603,7 +1603,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1667,7 +1667,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -1689,7 +1689,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1699,7 +1699,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1845,7 +1845,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -1867,7 +1867,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1877,7 +1877,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1990,7 +1990,7 @@ "requestBody": { "description": "The identities of the empties to add to the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2009,7 +2009,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2019,7 +2019,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2029,7 +2029,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2039,7 +2039,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2070,7 +2070,7 @@ "requestBody": { "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2089,7 +2089,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2099,7 +2099,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2109,7 +2109,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2119,7 +2119,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2150,7 +2150,7 @@ "requestBody": { "description": "The identities of the empties to remove from the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2169,7 +2169,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2179,7 +2179,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2189,7 +2189,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2199,7 +2199,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2263,9 +2263,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableEmptySecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" } } } @@ -2285,7 +2285,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2295,7 +2295,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2441,7 +2441,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" } @@ -2463,7 +2463,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2473,7 +2473,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2586,7 +2586,7 @@ "requestBody": { "description": "The identity of the empty to assign to the toOne relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2605,7 +2605,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2615,7 +2615,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2625,7 +2625,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2635,7 +2635,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2648,193 +2648,206 @@ }, "components": { "schemas": { - "attributesInCreateResourceRequest": { + "attributesInCreateRequest": { "required": [ - "requiredNullableValueType", - "requiredReferenceType" + "openapi:discriminator" ], "type": "object", "properties": { - "referenceType": { - "type": "string", - "nullable": true - }, - "requiredReferenceType": { - "minLength": 1, - "type": "string" - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true }, - "attributesInUpdateResourceRequest": { - "type": "object", - "properties": { - "referenceType": { - "type": "string", - "nullable": true - }, - "requiredReferenceType": { - "minLength": 1, - "type": "string" - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32" + { + "required": [ + "requiredNullableValueType", + "requiredReferenceType" + ], + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createResourceRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateResourceRequest" - } - ] + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateResourceRequest": { + "attributesInResponse": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateResourceRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true }, - "dataInResponse": { + "attributesInUpdateRequest": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { "$ref": "#/components/schemas/resourceType" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false, "discriminator": { - "propertyName": "type", + "propertyName": "openapi:discriminator", "mapping": { - "empties": "#/components/schemas/emptyDataInResponse", - "resources": "#/components/schemas/resourceDataInResponse" + "resources": "#/components/schemas/attributesInUpdateResourceRequest" } }, "x-abstract": true }, - "dataInUpdateResourceRequest": { + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { "required": [ - "id", - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateResourceRequest" - } - ] - }, - "relationships": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] }, @@ -2848,46 +2861,112 @@ }, "additionalProperties": false }, - "emptyCollectionResponseDocument": { - "required": [ - "data", - "links" - ], + "dataInCreateResourceRequest": { "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" - } - ] + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/emptyDataInResponse" - } + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "emptyDataInResponse": { + "dataInUpdateResourceRequest": { + "type": "object", "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInUpdateRequest" }, { "required": [ @@ -2900,10 +2979,17 @@ "type": "string", "format": "int32" }, - "links": { + "attributes": { "allOf": [ { - "$ref": "#/components/schemas/resourceLinks" + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" } ] } @@ -2913,7 +2999,7 @@ ], "additionalProperties": false }, - "emptyIdentifierCollectionResponseDocument": { + "emptyCollectionResponseDocument": { "required": [ "data", "links" @@ -2923,14 +3009,20 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, "data": { "type": "array", "items": { - "$ref": "#/components/schemas/emptyIdentifierInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -2943,24 +3035,25 @@ }, "additionalProperties": false }, - "emptyIdentifierInRequest": { + "emptyIdentifierCollectionResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/emptyResourceType" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } }, "meta": { "allOf": [ @@ -2972,6 +3065,29 @@ }, "additionalProperties": false }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "emptyIdentifierInResponse": { "required": [ "id", @@ -3038,43 +3154,6 @@ ], "type": "string" }, - "emptySecondaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/emptyDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "errorLinks": { "type": "object", "properties": { @@ -3197,6 +3276,36 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, "meta": { "type": "object", "additionalProperties": { @@ -3235,7 +3344,7 @@ }, "additionalProperties": false }, - "nullableEmptySecondaryResponseDocument": { + "nullableSecondaryEmptyResponseDocument": { "required": [ "data", "links" @@ -3252,7 +3361,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/emptyDataInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" } ], "nullable": true @@ -3260,7 +3369,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3325,6 +3434,43 @@ }, "additionalProperties": false }, + "primaryResourceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResourceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "relationshipLinks": { "type": "object", "properties": { @@ -3334,109 +3480,205 @@ "related": { "type": "string" } - }, + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "requiredToOne" + ], + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], "additionalProperties": false }, - "relationshipsInCreateResourceRequest": { + "relationshipsInResponse": { "required": [ - "requiredToOne" + "openapi:discriminator" ], "type": "object", "properties": { - "toOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" - } - ] - }, - "requiredToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] - }, - "toMany": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEmptyInRequest" - } - ] - }, - "requiredToMany": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" + } + }, + "x-abstract": true }, - "relationshipsInUpdateResourceRequest": { + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "toOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" - } - ] - }, - "requiredToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] - }, - "toMany": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" - } - ] - }, - "requiredToMany": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + }, + "x-abstract": true }, - "resourceAttributesInResponse": { - "type": "object", - "properties": { - "referenceType": { - "type": "string", - "nullable": true - }, - "requiredReferenceType": { - "minLength": 1, - "type": "string" - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32" + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "resourceCollectionResponseDocument": { @@ -3456,13 +3698,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/dataInResourceResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3499,49 +3741,6 @@ }, "additionalProperties": false }, - "resourceDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "resourceIdentifierCollectionTopLevelLinks": { "type": "object", "properties": { @@ -3584,42 +3783,19 @@ }, "additionalProperties": false }, - "resourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourcePrimaryResponseDocument": { + "resourceInCreateRequest": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -3628,47 +3804,84 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true }, - "resourceRelationshipsInResponse": { + "resourceInResponse": { + "required": [ + "type" + ], "type": "object", "properties": { - "toOne": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredToOne": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toOneEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] - }, - "toMany": { + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredToMany": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true }, - "resourceResourceType": { - "enum": [ - "resources" - ], - "type": "string" + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false }, "resourceTopLevelLinks": { "type": "object", @@ -3689,6 +3902,43 @@ ], "type": "string" }, + "secondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "toManyEmptyInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs index f6214ee6eb..bdb8fdb84e 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs @@ -26,7 +26,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -46,7 +46,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -63,7 +63,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { @@ -85,7 +85,7 @@ public async Task Schema_property_for_relationship_is_not_nullable(string jsonPr JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs index b0b9ab01f3..42e2efc614 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs @@ -24,7 +24,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -42,7 +42,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -57,7 +57,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -74,7 +74,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -88,7 +88,10 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceAttributesInPatchRequest.required"); + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); } [Fact] @@ -98,6 +101,9 @@ public async Task No_relationship_schema_properties_are_required_for_updating_re JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceRelationshipsInPatchRequest.required"); + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); } } diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 85591bdc4c..1b962dc499 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/resourceCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -319,9 +319,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -341,7 +341,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -351,7 +351,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -477,7 +477,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -493,9 +493,9 @@ "200": { "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -506,7 +506,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -516,7 +516,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -526,7 +526,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -536,7 +536,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -571,7 +571,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -635,9 +635,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/emptySecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" } } } @@ -657,7 +657,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -667,7 +667,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -813,7 +813,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierResponseDocument" } @@ -835,7 +835,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -845,7 +845,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -958,7 +958,7 @@ "requestBody": { "description": "The identity of the empty to assign to the nonNullableToOne relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -977,7 +977,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -987,7 +987,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -997,7 +997,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1007,7 +1007,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1071,9 +1071,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableEmptySecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" } } } @@ -1093,7 +1093,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1103,7 +1103,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1249,7 +1249,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" } @@ -1271,7 +1271,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1281,7 +1281,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1394,7 +1394,7 @@ "requestBody": { "description": "The identity of the empty to assign to the nullableToOne relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1413,7 +1413,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1423,7 +1423,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1433,7 +1433,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1443,7 +1443,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1507,9 +1507,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/emptySecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" } } } @@ -1529,7 +1529,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1539,7 +1539,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1685,7 +1685,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierResponseDocument" } @@ -1707,7 +1707,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1717,7 +1717,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1830,7 +1830,7 @@ "requestBody": { "description": "The identity of the empty to assign to the requiredNonNullableToOne relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1849,7 +1849,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1859,7 +1859,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1869,7 +1869,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1879,7 +1879,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1943,9 +1943,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableEmptySecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" } } } @@ -1965,7 +1965,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1975,7 +1975,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2121,7 +2121,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" } @@ -2143,7 +2143,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2153,7 +2153,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2266,7 +2266,7 @@ "requestBody": { "description": "The identity of the empty to assign to the requiredNullableToOne relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2285,7 +2285,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2295,7 +2295,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2305,7 +2305,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2315,7 +2315,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2379,7 +2379,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -2401,7 +2401,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2411,7 +2411,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2557,7 +2557,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -2579,7 +2579,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2589,7 +2589,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2702,7 +2702,7 @@ "requestBody": { "description": "The identities of the empties to add to the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2721,7 +2721,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2731,7 +2731,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2741,7 +2741,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2751,7 +2751,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2782,7 +2782,7 @@ "requestBody": { "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2801,7 +2801,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2811,7 +2811,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2821,7 +2821,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2831,7 +2831,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2862,7 +2862,7 @@ "requestBody": { "description": "The identities of the empties to remove from the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2881,7 +2881,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2891,7 +2891,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2901,7 +2901,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2911,7 +2911,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2975,7 +2975,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -2997,7 +2997,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3007,7 +3007,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3153,7 +3153,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -3175,7 +3175,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3185,7 +3185,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3298,7 +3298,7 @@ "requestBody": { "description": "The identities of the empties to add to the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3317,7 +3317,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3327,7 +3327,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3337,7 +3337,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3347,7 +3347,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3378,7 +3378,7 @@ "requestBody": { "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3397,7 +3397,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3407,7 +3407,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3417,7 +3417,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3427,7 +3427,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3458,7 +3458,7 @@ "requestBody": { "description": "The identities of the empties to remove from the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3477,7 +3477,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3487,7 +3487,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3497,7 +3497,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3507,7 +3507,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3520,213 +3520,235 @@ }, "components": { "schemas": { - "attributesInCreateResourceRequest": { + "attributesInCreateRequest": { "required": [ - "requiredNonNullableReferenceType", - "requiredNullableReferenceType", - "requiredNullableValueType", - "requiredValueType" + "openapi:discriminator" ], "type": "object", "properties": { - "nonNullableReferenceType": { - "type": "string" - }, - "requiredNonNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "nullableReferenceType": { - "type": "string", - "nullable": true - }, - "requiredNullableReferenceType": { - "minLength": 1, - "type": "string", - "nullable": true - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true }, - "attributesInUpdateResourceRequest": { - "type": "object", - "properties": { - "nonNullableReferenceType": { - "type": "string" - }, - "requiredNonNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "nullableReferenceType": { - "type": "string", - "nullable": true - }, - "requiredNullableReferenceType": { - "minLength": 1, - "type": "string", - "nullable": true - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + { + "required": [ + "requiredNonNullableReferenceType", + "requiredNullableReferenceType", + "requiredNullableValueType", + "requiredValueType" + ], + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createResourceRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateResourceRequest" - } - ] + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateResourceRequest": { + "attributesInResponse": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateResourceRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true }, - "dataInResponse": { + "attributesInUpdateRequest": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { "$ref": "#/components/schemas/resourceType" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false, "discriminator": { - "propertyName": "type", + "propertyName": "openapi:discriminator", "mapping": { - "empties": "#/components/schemas/emptyDataInResponse", - "resources": "#/components/schemas/resourceDataInResponse" + "resources": "#/components/schemas/attributesInUpdateResourceRequest" } }, "x-abstract": true }, - "dataInUpdateResourceRequest": { + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { "required": [ - "id", - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateResourceRequest" - } - ] - }, - "relationships": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] }, @@ -3740,46 +3762,68 @@ }, "additionalProperties": false }, - "emptyCollectionResponseDocument": { - "required": [ - "data", - "links" - ], + "dataInCreateResourceRequest": { "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" - } - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/emptyDataInResponse" - } + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "emptyDataInResponse": { + "dataInResourceResponse": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" }, { "required": [ @@ -3792,6 +3836,20 @@ "type": "string", "format": "int32" }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, "links": { "allOf": [ { @@ -3805,7 +3863,44 @@ ], "additionalProperties": false }, - "emptyIdentifierCollectionResponseDocument": { + "dataInUpdateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyCollectionResponseDocument": { "required": [ "data", "links" @@ -3815,14 +3910,20 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, "data": { "type": "array", "items": { - "$ref": "#/components/schemas/emptyIdentifierInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3835,24 +3936,25 @@ }, "additionalProperties": false }, - "emptyIdentifierInRequest": { + "emptyIdentifierCollectionResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/emptyResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } }, "meta": { "allOf": [ @@ -3864,6 +3966,29 @@ }, "additionalProperties": false }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "emptyIdentifierInResponse": { "required": [ "id", @@ -3930,43 +4055,6 @@ ], "type": "string" }, - "emptySecondaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/emptyDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "errorLinks": { "type": "object", "properties": { @@ -4089,6 +4177,36 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, "meta": { "type": "object", "additionalProperties": { @@ -4127,7 +4245,7 @@ }, "additionalProperties": false }, - "nullableEmptySecondaryResponseDocument": { + "nullableSecondaryEmptyResponseDocument": { "required": [ "data", "links" @@ -4144,7 +4262,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/emptyDataInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" } ], "nullable": true @@ -4152,7 +4270,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4217,157 +4335,295 @@ }, "additionalProperties": false }, - "relationshipLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "related": { - "type": "string" - } - }, - "additionalProperties": false - }, - "relationshipsInCreateResourceRequest": { + "primaryResourceResponseDocument": { "required": [ - "requiredNonNullableToOne", - "requiredNullableToOne", - "requiredToMany" + "data", + "links" ], "type": "object", "properties": { - "nonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] - }, - "requiredNonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] - }, - "nullableToOne": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, - "requiredNullableToOne": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + "$ref": "#/components/schemas/dataInResourceResponse" } ] }, - "toMany": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEmptyInRequest" - } - ] + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, - "requiredToMany": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false }, - "relationshipsInUpdateResourceRequest": { + "relationshipLinks": { "type": "object", "properties": { - "nonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] + "self": { + "type": "string" }, - "requiredNonNullableToOne": { + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "nullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + { + "required": [ + "requiredNonNullableToOne", + "requiredNullableToOne", + "requiredToMany" + ], + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "requiredNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] } - ] - }, - "toMany": { + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] - }, - "requiredToMany": { + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + }, + "x-abstract": true }, - "resourceAttributesInResponse": { - "type": "object", - "properties": { - "nonNullableReferenceType": { - "type": "string" - }, - "requiredNonNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "nullableReferenceType": { - "type": "string", - "nullable": true - }, - "requiredNullableReferenceType": { - "minLength": 1, - "type": "string", - "nullable": true - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "resourceCollectionResponseDocument": { @@ -4387,13 +4643,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/dataInResourceResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4430,49 +4686,6 @@ }, "additionalProperties": false }, - "resourceDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "resourceIdentifierCollectionTopLevelLinks": { "type": "object", "properties": { @@ -4515,42 +4728,19 @@ }, "additionalProperties": false }, - "resourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourcePrimaryResponseDocument": { + "resourceInCreateRequest": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -4559,61 +4749,84 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true }, - "resourceRelationshipsInResponse": { + "resourceInResponse": { + "required": [ + "type" + ], "type": "object", "properties": { - "nonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInResponse" - } - ] - }, - "requiredNonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInResponse" - } - ] - }, - "nullableToOne": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredNullableToOne": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] - }, - "toMany": { + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredToMany": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true }, - "resourceResourceType": { - "enum": [ - "resources" - ], - "type": "string" + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false }, "resourceTopLevelLinks": { "type": "object", @@ -4634,6 +4847,43 @@ ], "type": "string" }, + "secondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "toManyEmptyInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs index 9ae0cb4bd4..5c795c8cad 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs @@ -28,7 +28,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -48,7 +48,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -66,7 +66,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { @@ -89,7 +89,7 @@ public async Task Schema_property_for_relationship_is_not_nullable(string jsonPr JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs index 033c65c7b1..c4512e4cfd 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs @@ -26,7 +26,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -44,7 +44,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -61,7 +61,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -78,7 +78,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -92,7 +92,10 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceAttributesInPatchRequest.required"); + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); } [Fact] @@ -102,6 +105,9 @@ public async Task No_relationship_schema_properties_are_required_for_updating_re JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceRelationshipsInPatchRequest.required"); + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); } } diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index a059d33d88..0717249aa5 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/resourceCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -176,7 +176,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -202,9 +202,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -215,7 +215,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -225,7 +225,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -235,7 +235,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -245,7 +245,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -255,7 +255,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -319,9 +319,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -341,7 +341,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -351,7 +351,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -477,7 +477,7 @@ "requestBody": { "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -493,9 +493,9 @@ "200": { "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/resourcePrimaryResponseDocument" + "$ref": "#/components/schemas/primaryResourceResponseDocument" } } } @@ -506,7 +506,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -516,7 +516,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -526,7 +526,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -536,7 +536,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -571,7 +571,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -635,9 +635,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/emptySecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" } } } @@ -657,7 +657,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -667,7 +667,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -813,7 +813,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierResponseDocument" } @@ -835,7 +835,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -845,7 +845,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -958,7 +958,7 @@ "requestBody": { "description": "The identity of the empty to assign to the nonNullableToOne relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -977,7 +977,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -987,7 +987,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -997,7 +997,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1007,7 +1007,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1071,9 +1071,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableEmptySecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" } } } @@ -1093,7 +1093,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1103,7 +1103,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1249,7 +1249,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" } @@ -1271,7 +1271,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1281,7 +1281,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1394,7 +1394,7 @@ "requestBody": { "description": "The identity of the empty to assign to the nullableToOne relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1413,7 +1413,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1423,7 +1423,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1433,7 +1433,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1443,7 +1443,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1507,9 +1507,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/emptySecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" } } } @@ -1529,7 +1529,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1539,7 +1539,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1685,7 +1685,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierResponseDocument" } @@ -1707,7 +1707,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1717,7 +1717,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1830,7 +1830,7 @@ "requestBody": { "description": "The identity of the empty to assign to the requiredNonNullableToOne relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -1849,7 +1849,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1859,7 +1859,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1869,7 +1869,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1879,7 +1879,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1943,9 +1943,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/emptySecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" } } } @@ -1965,7 +1965,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1975,7 +1975,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2121,7 +2121,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierResponseDocument" } @@ -2143,7 +2143,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2153,7 +2153,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2266,7 +2266,7 @@ "requestBody": { "description": "The identity of the empty to assign to the requiredNullableToOne relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2285,7 +2285,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2295,7 +2295,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2305,7 +2305,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2315,7 +2315,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2379,7 +2379,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -2401,7 +2401,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2411,7 +2411,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2557,7 +2557,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -2579,7 +2579,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2589,7 +2589,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2702,7 +2702,7 @@ "requestBody": { "description": "The identities of the empties to add to the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2721,7 +2721,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2731,7 +2731,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2741,7 +2741,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2751,7 +2751,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2782,7 +2782,7 @@ "requestBody": { "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2801,7 +2801,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2811,7 +2811,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2821,7 +2821,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2831,7 +2831,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2862,7 +2862,7 @@ "requestBody": { "description": "The identities of the empties to remove from the requiredToMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2881,7 +2881,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2891,7 +2891,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2901,7 +2901,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2911,7 +2911,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2975,7 +2975,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyCollectionResponseDocument" } @@ -2997,7 +2997,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3007,7 +3007,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3153,7 +3153,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" } @@ -3175,7 +3175,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3185,7 +3185,7 @@ "404": { "description": "The resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3298,7 +3298,7 @@ "requestBody": { "description": "The identities of the empties to add to the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3317,7 +3317,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3327,7 +3327,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3337,7 +3337,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3347,7 +3347,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3378,7 +3378,7 @@ "requestBody": { "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3397,7 +3397,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3407,7 +3407,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3417,7 +3417,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3427,7 +3427,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3458,7 +3458,7 @@ "requestBody": { "description": "The identities of the empties to remove from the toMany relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3477,7 +3477,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3487,7 +3487,7 @@ "404": { "description": "The resource or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3497,7 +3497,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3507,7 +3507,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3520,209 +3520,229 @@ }, "components": { "schemas": { - "attributesInCreateResourceRequest": { + "attributesInCreateRequest": { "required": [ - "nonNullableReferenceType", - "requiredNonNullableReferenceType", - "requiredNullableReferenceType", - "requiredNullableValueType" + "openapi:discriminator" ], "type": "object", "properties": { - "nonNullableReferenceType": { - "type": "string" - }, - "requiredNonNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "nullableReferenceType": { - "type": "string", - "nullable": true - }, - "requiredNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32" + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true }, - "attributesInUpdateResourceRequest": { - "type": "object", - "properties": { - "nonNullableReferenceType": { - "type": "string" - }, - "requiredNonNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "nullableReferenceType": { - "type": "string", - "nullable": true - }, - "requiredNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32" + { + "required": [ + "nonNullableReferenceType", + "requiredNonNullableReferenceType", + "requiredNullableReferenceType", + "requiredNullableValueType" + ], + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "createResourceRequestDocument": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInCreateResourceRequest" - } - ] + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateResourceRequest": { + "attributesInResponse": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateResourceRequest" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" - } - ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true }, - "dataInResponse": { + "attributesInUpdateRequest": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { "$ref": "#/components/schemas/resourceType" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false, "discriminator": { - "propertyName": "type", + "propertyName": "openapi:discriminator", "mapping": { - "empties": "#/components/schemas/emptyDataInResponse", - "resources": "#/components/schemas/resourceDataInResponse" + "resources": "#/components/schemas/attributesInUpdateResourceRequest" } }, "x-abstract": true }, - "dataInUpdateResourceRequest": { + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { "required": [ - "id", - "type" + "data" ], "type": "object", "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceResourceType" - } - ] - }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateResourceRequest" - } - ] - }, - "relationships": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] }, @@ -3736,46 +3756,68 @@ }, "additionalProperties": false }, - "emptyCollectionResponseDocument": { - "required": [ - "data", - "links" - ], + "dataInCreateResourceRequest": { "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" - } - ] - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/emptyDataInResponse" - } + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "emptyDataInResponse": { + "dataInResourceResponse": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" }, { "required": [ @@ -3788,6 +3830,20 @@ "type": "string", "format": "int32" }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, "links": { "allOf": [ { @@ -3801,7 +3857,44 @@ ], "additionalProperties": false }, - "emptyIdentifierCollectionResponseDocument": { + "dataInUpdateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyCollectionResponseDocument": { "required": [ "data", "links" @@ -3811,14 +3904,20 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, "data": { "type": "array", "items": { - "$ref": "#/components/schemas/emptyIdentifierInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -3831,24 +3930,25 @@ }, "additionalProperties": false }, - "emptyIdentifierInRequest": { + "emptyIdentifierCollectionResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/emptyResourceType" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int32" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } }, "meta": { "allOf": [ @@ -3860,6 +3960,29 @@ }, "additionalProperties": false }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "emptyIdentifierInResponse": { "required": [ "id", @@ -3926,43 +4049,6 @@ ], "type": "string" }, - "emptySecondaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/emptyDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "errorLinks": { "type": "object", "properties": { @@ -4085,6 +4171,36 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, "meta": { "type": "object", "additionalProperties": { @@ -4123,7 +4239,7 @@ }, "additionalProperties": false }, - "nullableEmptySecondaryResponseDocument": { + "nullableSecondaryEmptyResponseDocument": { "required": [ "data", "links" @@ -4140,7 +4256,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/emptyDataInResponse" + "$ref": "#/components/schemas/dataInEmptyResponse" } ], "nullable": true @@ -4148,7 +4264,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4213,155 +4329,295 @@ }, "additionalProperties": false }, - "relationshipLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - }, - "related": { - "type": "string" - } - }, - "additionalProperties": false - }, - "relationshipsInCreateResourceRequest": { + "primaryResourceResponseDocument": { "required": [ - "nonNullableToOne", - "requiredNonNullableToOne", - "requiredNullableToOne" + "data", + "links" ], "type": "object", "properties": { - "nonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] - }, - "requiredNonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] - }, - "nullableToOne": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, - "requiredNullableToOne": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/toOneEmptyInRequest" + "$ref": "#/components/schemas/dataInResourceResponse" } ] }, - "toMany": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyEmptyInRequest" - } - ] + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } }, - "requiredToMany": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false }, - "relationshipsInUpdateResourceRequest": { + "relationshipLinks": { "type": "object", "properties": { - "nonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" - } - ] + "self": { + "type": "string" }, - "requiredNonNullableToOne": { + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "nullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + { + "required": [ + "nonNullableToOne", + "requiredNonNullableToOne", + "requiredNullableToOne" + ], + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "requiredNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInRequest" + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] } - ] - }, - "toMany": { + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] - }, - "requiredToMany": { + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + }, + "x-abstract": true }, - "resourceAttributesInResponse": { - "type": "object", - "properties": { - "nonNullableReferenceType": { - "type": "string" - }, - "requiredNonNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "nullableReferenceType": { - "type": "string", - "nullable": true - }, - "requiredNullableReferenceType": { - "minLength": 1, - "type": "string" - }, - "valueType": { - "type": "integer", - "format": "int32" - }, - "requiredValueType": { - "type": "integer", - "format": "int32" - }, - "nullableValueType": { - "type": "integer", - "format": "int32", - "nullable": true + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "requiredNullableValueType": { - "type": "integer", - "format": "int32" + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "resourceCollectionResponseDocument": { @@ -4381,13 +4637,13 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/dataInResourceResponse" } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4424,49 +4680,6 @@ }, "additionalProperties": false }, - "resourceDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int32" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, "resourceIdentifierCollectionTopLevelLinks": { "type": "object", "properties": { @@ -4509,42 +4722,19 @@ }, "additionalProperties": false }, - "resourceLinks": { - "type": "object", - "properties": { - "self": { - "type": "string" - } - }, - "additionalProperties": false - }, - "resourcePrimaryResponseDocument": { + "resourceInCreateRequest": { "required": [ - "data", - "links" + "type" ], "type": "object", "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/resourceDataInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -4553,61 +4743,84 @@ ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true }, - "resourceRelationshipsInResponse": { + "resourceInResponse": { + "required": [ + "type" + ], "type": "object", "properties": { - "nonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInResponse" - } - ] - }, - "requiredNonNullableToOne": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneEmptyInResponse" - } - ] - }, - "nullableToOne": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredNullableToOne": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toOneEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] - }, - "toMany": { + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/resourceType" } ] }, - "requiredToMany": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyEmptyInResponse" + "$ref": "#/components/schemas/meta" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true }, - "resourceResourceType": { - "enum": [ - "resources" - ], - "type": "string" + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false }, "resourceTopLevelLinks": { "type": "object", @@ -4628,6 +4841,43 @@ ], "type": "string" }, + "secondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, "toManyEmptyInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs index f594219cff..6a0bbac52c 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs @@ -26,7 +26,7 @@ public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyN JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -48,7 +48,7 @@ public async Task Schema_property_for_attribute_is_not_nullable(string jsonPrope JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.resourceAttributesInResponse.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => { @@ -65,7 +65,7 @@ public async Task Schema_property_for_relationship_is_nullable(string jsonProper JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { @@ -89,7 +89,7 @@ public async Task Schema_property_for_relationship_is_not_nullable(string jsonPr JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.properties").With(schemaProperties => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => { schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => { diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs index 1e3b9cd39e..11d9e02bca 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs @@ -26,7 +26,7 @@ public async Task Schema_property_for_attribute_is_required_for_creating_resourc JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -44,7 +44,7 @@ public async Task Schema_property_for_attribute_is_not_required_for_creating_res JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest").With(attributesSchema => + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => { attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -61,7 +61,7 @@ public async Task Schema_property_for_relationship_is_required_for_creating_reso JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); @@ -78,7 +78,7 @@ public async Task Schema_property_for_relationship_is_not_required_for_creating_ JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest").With(relationshipsSchema => + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => { relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); @@ -92,7 +92,10 @@ public async Task No_attribute_schema_properties_are_required_for_updating_resou JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceAttributesInPatchRequest.required"); + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); } [Fact] @@ -102,6 +105,9 @@ public async Task No_relationship_schema_properties_are_required_for_updating_re JsonElement document = await _testContext.GetSwaggerDocumentAsync(); // Assert - document.Should().NotContainPath("components.schemas.resourceRelationshipsInPatchRequest.required"); + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); } } diff --git a/test/OpenApiTests/ResourceInheritance/Everything/EverythingInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/Everything/EverythingInheritanceTests.cs new file mode 100644 index 0000000000..57240b59e5 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Everything/EverythingInheritanceTests.cs @@ -0,0 +1,336 @@ +using JsonApiDotNetCore.Controllers; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.Everything; + +public sealed class EverythingInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : ResourceInheritanceTests(testContext, true, false) +{ + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.All)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.All)] + [InlineData(typeof(Building), JsonApiEndpoints.All)] + [InlineData(typeof(Residence), JsonApiEndpoints.All)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.All)] + [InlineData(typeof(Mansion), JsonApiEndpoints.All)] + [InlineData(typeof(Room), JsonApiEndpoints.All)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.All)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.All)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.All)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.All)] + [InlineData(typeof(Toilet), JsonApiEndpoints.All)] + [InlineData(typeof(Road), JsonApiEndpoints.All)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.All)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addBuilding|updateBuilding|removeBuilding|" + + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addRoom|updateRoom|removeRoom|updateRoomResidence|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence|" + + "addDistrict|updateDistrict|removeDistrict|addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads|" + + "addRoad|updateRoad|removeRoad|" + + "addCyclePath|updateCyclePath|removeCyclePath|" + + "addStaffMember|updateStaffMember|removeStaffMember" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, "atomicOperation", "op|data")] + [InlineData("createResidenceOperation", false, "createBuildingOperation", null)] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateResidenceOperation", false, "updateBuildingOperation", null)] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteResidenceOperation", false, "deleteBuildingOperation", null)] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateBedroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateKitchenOperation", false, "updateRoomOperation", null)] + [InlineData("updateLivingRoomOperation", false, "updateRoomOperation", null)] + [InlineData("updateToiletOperation", false, "updateRoomOperation", null)] + [InlineData("deleteRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBathroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteBedroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteKitchenOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteLivingRoomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteToiletOperation", false, "deleteRoomOperation", null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, "atomicOperation", "op|data")] + [InlineData("createCyclePathOperation", false, "createRoadOperation", null)] + [InlineData("updateRoadOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateCyclePathOperation", false, "updateRoadOperation", null)] + [InlineData("deleteRoadOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteCyclePathOperation", false, "deleteRoadOperation", null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Bathroom.cs b/test/OpenApiTests/ResourceInheritance/Models/Bathroom.cs new file mode 100644 index 0000000000..1b67bd24b1 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Bathroom.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Bathroom : Room +{ + [Attr] + [Required] + public bool? HasBath { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Bedroom.cs b/test/OpenApiTests/ResourceInheritance/Models/Bedroom.cs new file mode 100644 index 0000000000..3cf0a22e11 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Bedroom.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Bedroom : Room +{ + [Attr] + [Required] + public int? BedCount { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Building.cs b/test/OpenApiTests/ResourceInheritance/Models/Building.cs new file mode 100644 index 0000000000..361a3a374f --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Building.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public abstract class Building : Identifiable +{ + [Attr] + [Required] + public int? SurfaceInSquareMeters { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/CyclePath.cs b/test/OpenApiTests/ResourceInheritance/Models/CyclePath.cs new file mode 100644 index 0000000000..e282e47306 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/CyclePath.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class CyclePath : Road +{ + [Attr] + public bool HasLaneForPedestrians { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/District.cs b/test/OpenApiTests/ResourceInheritance/Models/District.cs new file mode 100644 index 0000000000..3ef752e386 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/District.cs @@ -0,0 +1,19 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class District : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [HasMany] + public ISet Buildings { get; set; } = new HashSet(); + + [HasMany] + public ISet Roads { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/FamilyHome.cs b/test/OpenApiTests/ResourceInheritance/Models/FamilyHome.cs new file mode 100644 index 0000000000..37533383c3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/FamilyHome.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class FamilyHome : Residence +{ + [Attr] + [Required] + public int FloorCount { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Kitchen.cs b/test/OpenApiTests/ResourceInheritance/Models/Kitchen.cs new file mode 100644 index 0000000000..d20206fe7e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Kitchen.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Kitchen : Room +{ + [Attr] + [Required] + public bool? HasPantry { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/LivingRoom.cs b/test/OpenApiTests/ResourceInheritance/Models/LivingRoom.cs new file mode 100644 index 0000000000..467f5f5aa3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/LivingRoom.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class LivingRoom : Room +{ + [Attr] + [Required] + public bool? HasDiningTable { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs b/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs new file mode 100644 index 0000000000..acf87c8eee --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs @@ -0,0 +1,15 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Mansion : Residence +{ + [Attr] + public string OwnerName { get; set; } = null!; + + [HasMany] + public ISet Staff { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Residence.cs b/test/OpenApiTests/ResourceInheritance/Models/Residence.cs new file mode 100644 index 0000000000..fa6ca835cf --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Residence.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public class Residence : Building +{ + [Attr] + [Required] + public int? NumberOfResidents { get; set; } + + [HasMany] + public ISet Rooms { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Road.cs b/test/OpenApiTests/ResourceInheritance/Models/Road.cs new file mode 100644 index 0000000000..c89d7a5d4b --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Road.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public class Road : Identifiable +{ + [Attr] + public decimal LengthInMeters { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Room.cs b/test/OpenApiTests/ResourceInheritance/Models/Room.cs new file mode 100644 index 0000000000..6cf38598b7 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Room.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public abstract class Room : Identifiable +{ + [Attr] + [Required] + public int? SurfaceInSquareMeters { get; set; } + + [HasOne] + public Residence Residence { get; set; } = null!; +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs b/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs new file mode 100644 index 0000000000..0baa95db7e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class StaffMember : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Toilet.cs b/test/OpenApiTests/ResourceInheritance/Models/Toilet.cs new file mode 100644 index 0000000000..9cade078ec --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Toilet.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Toilet : Room +{ + [Attr] + [Required] + public bool? HasSink { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..9dad8a07cb --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json @@ -0,0 +1,20013 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/bathrooms": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves a collection of bathrooms.", + "operationId": "getBathroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bathrooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/bathroomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves a collection of bathrooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "bathrooms" + ], + "summary": "Creates a new bathroom.", + "operationId": "postBathroom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bathroom to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBathroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The bathroom was successfully created, which resulted in additional changes. The newly created bathroom is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created bathroom can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBathroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bathroom was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bathrooms/{id}": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves an individual bathroom by its identifier.", + "operationId": "getBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bathroom.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBathroomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves an individual bathroom by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bathrooms" + ], + "summary": "Updates an existing bathroom.", + "operationId": "patchBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bathroom to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBathroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The bathroom was successfully updated, which resulted in additional changes. The updated bathroom is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBathroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bathroom was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "bathrooms" + ], + "summary": "Deletes an existing bathroom by its identifier.", + "operationId": "deleteBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The bathroom was successfully deleted." + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bathrooms/{id}/residence": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence of an individual bathroom's residence relationship.", + "operationId": "getBathroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence of an individual bathroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + } + }, + "/bathrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship.", + "operationId": "getBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bathrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bathroom.", + "operationId": "patchBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves a collection of bedrooms.", + "operationId": "getBedroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bedrooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/bedroomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves a collection of bedrooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "bedrooms" + ], + "summary": "Creates a new bedroom.", + "operationId": "postBedroom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bedroom to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBedroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The bedroom was successfully created, which resulted in additional changes. The newly created bedroom is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created bedroom can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBedroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bedroom was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms/{id}": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves an individual bedroom by its identifier.", + "operationId": "getBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bedroom.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBedroomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves an individual bedroom by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bedrooms" + ], + "summary": "Updates an existing bedroom.", + "operationId": "patchBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bedroom to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBedroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The bedroom was successfully updated, which resulted in additional changes. The updated bedroom is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBedroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bedroom was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "bedrooms" + ], + "summary": "Deletes an existing bedroom by its identifier.", + "operationId": "deleteBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The bedroom was successfully deleted." + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms/{id}/residence": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence of an individual bedroom's residence relationship.", + "operationId": "getBedroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence of an individual bedroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + } + }, + "/bedrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship.", + "operationId": "getBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bedrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bedroom.", + "operationId": "patchBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/buildings": { + "get": { + "tags": [ + "buildings" + ], + "summary": "Retrieves a collection of buildings.", + "operationId": "getBuildingCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found buildings, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "buildings" + ], + "summary": "Retrieves a collection of buildings without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBuildingCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "buildings" + ], + "summary": "Creates a new building.", + "operationId": "postBuilding", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The building was successfully created, which resulted in additional changes. The newly created building is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created building can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/buildings/{id}": { + "get": { + "tags": [ + "buildings" + ], + "summary": "Retrieves an individual building by its identifier.", + "operationId": "getBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found building.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The building does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "buildings" + ], + "summary": "Retrieves an individual building by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The building does not exist." + } + } + }, + "patch": { + "tags": [ + "buildings" + ], + "summary": "Updates an existing building.", + "operationId": "patchBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The building was successfully updated, which resulted in additional changes. The updated building is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The building or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "buildings" + ], + "summary": "Deletes an existing building by its identifier.", + "operationId": "deleteBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The building was successfully deleted." + }, + "404": { + "description": "The building does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/cyclePaths": { + "get": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves a collection of cyclePaths.", + "operationId": "getCyclePathCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found cyclePaths, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/cyclePathCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves a collection of cyclePaths without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCyclePathCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "cyclePaths" + ], + "summary": "Creates a new cyclePath.", + "operationId": "postCyclePath", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the cyclePath to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createCyclePathRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The cyclePath was successfully created, which resulted in additional changes. The newly created cyclePath is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created cyclePath can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "204": { + "description": "The cyclePath was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/cyclePaths/{id}": { + "get": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier.", + "operationId": "getCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found cyclePath.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The cyclePath does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The cyclePath does not exist." + } + } + }, + "patch": { + "tags": [ + "cyclePaths" + ], + "summary": "Updates an existing cyclePath.", + "operationId": "patchCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the cyclePath to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateCyclePathRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The cyclePath was successfully updated, which resulted in additional changes. The updated cyclePath is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "204": { + "description": "The cyclePath was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The cyclePath or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "cyclePaths" + ], + "summary": "Deletes an existing cyclePath by its identifier.", + "operationId": "deleteCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The cyclePath was successfully deleted." + }, + "404": { + "description": "The cyclePath does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts.", + "operationId": "getDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found districts, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/districtCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Creates a new district.", + "operationId": "postDistrict", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the district to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createDistrictRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The district was successfully created, which resulted in additional changes. The newly created district is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created district can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryDistrictResponseDocument" + } + } + } + }, + "204": { + "description": "The district was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves an individual district by its identifier.", + "operationId": "getDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found district.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryDistrictResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves an individual district by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Updates an existing district.", + "operationId": "patchDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the district to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateDistrictRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The district was successfully updated, which resulted in additional changes. The updated district is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryDistrictResponseDocument" + } + } + } + }, + "204": { + "description": "The district was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Deletes an existing district by its identifier.", + "operationId": "deleteDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "204": { + "description": "The district was successfully deleted." + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/buildings": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related buildings of an individual district's buildings relationship.", + "operationId": "getDistrictBuildings", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related buildings to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found buildings, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related buildings of an individual district's buildings relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictBuildings", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related buildings to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + } + }, + "/districts/{id}/relationships/buildings": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship.", + "operationId": "getDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found building identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing buildings to the buildings relationship of an individual district.", + "operationId": "postDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add buildings to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to add to the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing buildings to the buildings relationship of an individual district.", + "operationId": "patchDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose buildings relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to assign to the buildings relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing buildings from the buildings relationship of an individual district.", + "operationId": "deleteDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove buildings from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to remove from the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/roads": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related roads of an individual district's roads relationship.", + "operationId": "getDistrictRoads", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related roads to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found roads, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related roads of an individual district's roads relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictRoads", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related roads to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + } + }, + "/districts/{id}/relationships/roads": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship.", + "operationId": "getDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found road identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing roads to the roads relationship of an individual district.", + "operationId": "postDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add roads to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to add to the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing roads to the roads relationship of an individual district.", + "operationId": "patchDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose roads relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to assign to the roads relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing roads from the roads relationship of an individual district.", + "operationId": "deleteDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove roads from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to remove from the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves a collection of familyHomes.", + "operationId": "getFamilyHomeCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found familyHomes, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/familyHomeCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves a collection of familyHomes without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "familyHomes" + ], + "summary": "Creates a new familyHome.", + "operationId": "postFamilyHome", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the familyHome to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createFamilyHomeRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The familyHome was successfully created, which resulted in additional changes. The newly created familyHome is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created familyHome can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryFamilyHomeResponseDocument" + } + } + } + }, + "204": { + "description": "The familyHome was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes/{id}": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves an individual familyHome by its identifier.", + "operationId": "getFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found familyHome.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryFamilyHomeResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves an individual familyHome by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + }, + "patch": { + "tags": [ + "familyHomes" + ], + "summary": "Updates an existing familyHome.", + "operationId": "patchFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the familyHome to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateFamilyHomeRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The familyHome was successfully updated, which resulted in additional changes. The updated familyHome is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryFamilyHomeResponseDocument" + } + } + } + }, + "204": { + "description": "The familyHome was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "familyHomes" + ], + "summary": "Deletes an existing familyHome by its identifier.", + "operationId": "deleteFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The familyHome was successfully deleted." + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes/{id}/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related rooms of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related rooms of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + } + }, + "/familyHomes/{id}/relationships/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + }, + "post": { + "tags": [ + "familyHomes" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "postFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "familyHomes" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "patchFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "familyHomes" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual familyHome.", + "operationId": "deleteFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves a collection of kitchens.", + "operationId": "getKitchenCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found kitchens, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/kitchenCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves a collection of kitchens without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "kitchens" + ], + "summary": "Creates a new kitchen.", + "operationId": "postKitchen", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the kitchen to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createKitchenRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The kitchen was successfully created, which resulted in additional changes. The newly created kitchen is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created kitchen can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryKitchenResponseDocument" + } + } + } + }, + "204": { + "description": "The kitchen was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens/{id}": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves an individual kitchen by its identifier.", + "operationId": "getKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found kitchen.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryKitchenResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves an individual kitchen by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + }, + "patch": { + "tags": [ + "kitchens" + ], + "summary": "Updates an existing kitchen.", + "operationId": "patchKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the kitchen to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateKitchenRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The kitchen was successfully updated, which resulted in additional changes. The updated kitchen is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryKitchenResponseDocument" + } + } + } + }, + "204": { + "description": "The kitchen was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "kitchens" + ], + "summary": "Deletes an existing kitchen by its identifier.", + "operationId": "deleteKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The kitchen was successfully deleted." + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens/{id}/residence": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence of an individual kitchen's residence relationship.", + "operationId": "getKitchenResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence of an individual kitchen's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + } + }, + "/kitchens/{id}/relationships/residence": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship.", + "operationId": "getKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + }, + "patch": { + "tags": [ + "kitchens" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual kitchen.", + "operationId": "patchKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves a collection of livingRooms.", + "operationId": "getLivingRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found livingRooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/livingRoomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves a collection of livingRooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "livingRooms" + ], + "summary": "Creates a new livingRoom.", + "operationId": "postLivingRoom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the livingRoom to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createLivingRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The livingRoom was successfully created, which resulted in additional changes. The newly created livingRoom is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created livingRoom can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryLivingRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The livingRoom was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms/{id}": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves an individual livingRoom by its identifier.", + "operationId": "getLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found livingRoom.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryLivingRoomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves an individual livingRoom by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + }, + "patch": { + "tags": [ + "livingRooms" + ], + "summary": "Updates an existing livingRoom.", + "operationId": "patchLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the livingRoom to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateLivingRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The livingRoom was successfully updated, which resulted in additional changes. The updated livingRoom is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryLivingRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The livingRoom was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "livingRooms" + ], + "summary": "Deletes an existing livingRoom by its identifier.", + "operationId": "deleteLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The livingRoom was successfully deleted." + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms/{id}/residence": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence of an individual livingRoom's residence relationship.", + "operationId": "getLivingRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence of an individual livingRoom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + } + }, + "/livingRooms/{id}/relationships/residence": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship.", + "operationId": "getLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + }, + "patch": { + "tags": [ + "livingRooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual livingRoom.", + "operationId": "patchLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves a collection of mansions.", + "operationId": "getMansionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found mansions, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/mansionCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves a collection of mansions without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Creates a new mansion.", + "operationId": "postMansion", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the mansion to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createMansionRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The mansion was successfully created, which resulted in additional changes. The newly created mansion is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created mansion can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryMansionResponseDocument" + } + } + } + }, + "204": { + "description": "The mansion was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves an individual mansion by its identifier.", + "operationId": "getMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found mansion.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryMansionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves an individual mansion by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Updates an existing mansion.", + "operationId": "patchMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the mansion to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateMansionRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The mansion was successfully updated, which resulted in additional changes. The updated mansion is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryMansionResponseDocument" + } + } + } + }, + "204": { + "description": "The mansion was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Deletes an existing mansion by its identifier.", + "operationId": "deleteMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The mansion was successfully deleted." + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/rooms": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related rooms of an individual mansion's rooms relationship.", + "operationId": "getMansionRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related rooms of an individual mansion's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + } + }, + "/mansions/{id}/relationships/rooms": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship.", + "operationId": "getMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual mansion.", + "operationId": "postMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual mansion.", + "operationId": "patchMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual mansion.", + "operationId": "deleteMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/staff": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMembers of an individual mansion's staff relationship.", + "operationId": "getMansionStaff", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMembers of an individual mansion's staff relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionStaff", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + } + }, + "/mansions/{id}/relationships/staff": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship.", + "operationId": "getMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "postMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add staffMembers to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to add to the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "patchMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose staff relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to assign to the staff relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staff relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing staffMembers from the staff relationship of an individual mansion.", + "operationId": "deleteMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove staffMembers from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to remove from the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves a collection of residences.", + "operationId": "getResidenceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residences, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves a collection of residences without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "residences" + ], + "summary": "Creates a new residence.", + "operationId": "postResidence", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the residence to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createResidenceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The residence was successfully created, which resulted in additional changes. The newly created residence is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created residence can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResidenceResponseDocument" + } + } + } + }, + "204": { + "description": "The residence was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences/{id}": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves an individual residence by its identifier.", + "operationId": "getResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves an individual residence by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + }, + "patch": { + "tags": [ + "residences" + ], + "summary": "Updates an existing residence.", + "operationId": "patchResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the residence to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The residence was successfully updated, which resulted in additional changes. The updated residence is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResidenceResponseDocument" + } + } + } + }, + "204": { + "description": "The residence was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "residences" + ], + "summary": "Deletes an existing residence by its identifier.", + "operationId": "deleteResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The residence was successfully deleted." + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences/{id}/rooms": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related rooms of an individual residence's rooms relationship.", + "operationId": "getResidenceRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related rooms of an individual residence's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + } + }, + "/residences/{id}/relationships/rooms": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship.", + "operationId": "getResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + }, + "post": { + "tags": [ + "residences" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual residence.", + "operationId": "postResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "residences" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual residence.", + "operationId": "patchResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "residences" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual residence.", + "operationId": "deleteResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/roads": { + "get": { + "tags": [ + "roads" + ], + "summary": "Retrieves a collection of roads.", + "operationId": "getRoadCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found roads, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "roads" + ], + "summary": "Retrieves a collection of roads without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoadCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "roads" + ], + "summary": "Creates a new road.", + "operationId": "postRoad", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the road to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoadRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The road was successfully created, which resulted in additional changes. The newly created road is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created road can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoadResponseDocument" + } + } + } + }, + "204": { + "description": "The road was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/roads/{id}": { + "get": { + "tags": [ + "roads" + ], + "summary": "Retrieves an individual road by its identifier.", + "operationId": "getRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found road.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoadResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The road does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "roads" + ], + "summary": "Retrieves an individual road by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The road does not exist." + } + } + }, + "patch": { + "tags": [ + "roads" + ], + "summary": "Updates an existing road.", + "operationId": "patchRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the road to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoadRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The road was successfully updated, which resulted in additional changes. The updated road is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoadResponseDocument" + } + } + } + }, + "204": { + "description": "The road was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The road or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "roads" + ], + "summary": "Deletes an existing road by its identifier.", + "operationId": "deleteRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The road was successfully deleted." + }, + "404": { + "description": "The road does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves a collection of rooms.", + "operationId": "getRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves a collection of rooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "rooms" + ], + "summary": "Creates a new room.", + "operationId": "postRoom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the room to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The room was successfully created, which resulted in additional changes. The newly created room is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created room can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The room was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms/{id}": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves an individual room by its identifier.", + "operationId": "getRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves an individual room by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + }, + "patch": { + "tags": [ + "rooms" + ], + "summary": "Updates an existing room.", + "operationId": "patchRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the room to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The room was successfully updated, which resulted in additional changes. The updated room is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The room was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "rooms" + ], + "summary": "Deletes an existing room by its identifier.", + "operationId": "deleteRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The room was successfully deleted." + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms/{id}/residence": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence of an individual room's residence relationship.", + "operationId": "getRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence of an individual room's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + } + }, + "/rooms/{id}/relationships/residence": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship.", + "operationId": "getRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + }, + "patch": { + "tags": [ + "rooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual room.", + "operationId": "patchRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/staffMembers": { + "get": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves a collection of staffMembers.", + "operationId": "getStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves a collection of staffMembers without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "staffMembers" + ], + "summary": "Creates a new staffMember.", + "operationId": "postStaffMember", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staffMember to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The staffMember was successfully created, which resulted in additional changes. The newly created staffMember is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created staffMember can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The staffMember was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/staffMembers/{id}": { + "get": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves an individual staffMember by its identifier.", + "operationId": "getStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The staffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves an individual staffMember by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The staffMember does not exist." + } + } + }, + "patch": { + "tags": [ + "staffMembers" + ], + "summary": "Updates an existing staffMember.", + "operationId": "patchStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staffMember to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The staffMember was successfully updated, which resulted in additional changes. The updated staffMember is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The staffMember was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The staffMember or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "staffMembers" + ], + "summary": "Deletes an existing staffMember by its identifier.", + "operationId": "deleteStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The staffMember was successfully deleted." + }, + "404": { + "description": "The staffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves a collection of toilets.", + "operationId": "getToiletCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found toilets, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/toiletCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves a collection of toilets without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "toilets" + ], + "summary": "Creates a new toilet.", + "operationId": "postToilet", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the toilet to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createToiletRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The toilet was successfully created, which resulted in additional changes. The newly created toilet is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created toilet can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryToiletResponseDocument" + } + } + } + }, + "204": { + "description": "The toilet was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets/{id}": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves an individual toilet by its identifier.", + "operationId": "getToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found toilet.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryToiletResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves an individual toilet by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + }, + "patch": { + "tags": [ + "toilets" + ], + "summary": "Updates an existing toilet.", + "operationId": "patchToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the toilet to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateToiletRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The toilet was successfully updated, which resulted in additional changes. The updated toilet is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryToiletResponseDocument" + } + } + } + }, + "204": { + "description": "The toilet was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "toilets" + ], + "summary": "Deletes an existing toilet by its identifier.", + "operationId": "deleteToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The toilet was successfully deleted." + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets/{id}/residence": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence of an individual toilet's residence relationship.", + "operationId": "getToiletResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence of an individual toilet's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + } + }, + "/toilets/{id}/relationships/residence": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship.", + "operationId": "getToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + }, + "patch": { + "tags": [ + "toilets" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual toilet.", + "operationId": "patchToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator" + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributesInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasBath" + ], + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "bedCount" + ], + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoadRequest" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasPantry" + ], + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasDiningTable" + ], + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "required": [ + "ownerName" + ], + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInCreateBathroomRequest", + "bedrooms": "#/components/schemas/attributesInCreateBedroomRequest", + "buildings": "#/components/schemas/attributesInCreateBuildingRequest", + "cyclePaths": "#/components/schemas/attributesInCreateCyclePathRequest", + "districts": "#/components/schemas/attributesInCreateDistrictRequest", + "familyHomes": "#/components/schemas/attributesInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/attributesInCreateKitchenRequest", + "livingRooms": "#/components/schemas/attributesInCreateLivingRoomRequest", + "mansions": "#/components/schemas/attributesInCreateMansionRequest", + "residences": "#/components/schemas/attributesInCreateResidenceRequest", + "roads": "#/components/schemas/attributesInCreateRoadRequest", + "rooms": "#/components/schemas/attributesInCreateRoomRequest", + "staffMembers": "#/components/schemas/attributesInCreateStaffMemberRequest", + "toilets": "#/components/schemas/attributesInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + }, + { + "required": [ + "numberOfResidents" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasSink" + ], + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "buildings": "#/components/schemas/attributesInBuildingResponse", + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse", + "districts": "#/components/schemas/attributesInDistrictResponse", + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse", + "roads": "#/components/schemas/attributesInRoadResponse", + "rooms": "#/components/schemas/attributesInRoomResponse", + "staffMembers": "#/components/schemas/attributesInStaffMemberResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + }, + "attributesInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoadRequest" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInUpdateBathroomRequest", + "bedrooms": "#/components/schemas/attributesInUpdateBedroomRequest", + "buildings": "#/components/schemas/attributesInUpdateBuildingRequest", + "cyclePaths": "#/components/schemas/attributesInUpdateCyclePathRequest", + "districts": "#/components/schemas/attributesInUpdateDistrictRequest", + "familyHomes": "#/components/schemas/attributesInUpdateFamilyHomeRequest", + "kitchens": "#/components/schemas/attributesInUpdateKitchenRequest", + "livingRooms": "#/components/schemas/attributesInUpdateLivingRoomRequest", + "mansions": "#/components/schemas/attributesInUpdateMansionRequest", + "residences": "#/components/schemas/attributesInUpdateResidenceRequest", + "roads": "#/components/schemas/attributesInUpdateRoadRequest", + "rooms": "#/components/schemas/attributesInUpdateRoomRequest", + "staffMembers": "#/components/schemas/attributesInUpdateStaffMemberRequest", + "toilets": "#/components/schemas/attributesInUpdateToiletRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInBathroomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInBedroomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInBuildingResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "buildingIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "buildingIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "createBathroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBathroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createBedroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBedroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createCyclePathRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateCyclePathRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createDistrictRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateDistrictRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createFamilyHomeRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateFamilyHomeRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createKitchenRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateKitchenRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createLivingRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateLivingRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createMansionRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateMansionRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createResidenceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createRoadRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoadRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createToiletRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateToiletRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "cyclePathCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInCyclePathResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "cyclePathIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "cyclePathIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateBathroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBedroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateCyclePathRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateDistrictRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateDistrictRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateDistrictRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateKitchenRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateLivingRoomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateRoadRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoadRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoadRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateToiletRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInDistrictResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInDistrictResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/dataInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBathroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBedroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateCyclePathRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateDistrictRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateDistrictRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateDistrictRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateKitchenRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateLivingRoomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateRoadRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoadRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoadRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateToiletRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "districtCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInDistrictResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInFamilyHomeResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "buildings": "#/components/schemas/buildingIdentifierInRequest", + "cyclePaths": "#/components/schemas/cyclePathIdentifierInRequest", + "familyHomes": "#/components/schemas/familyHomeIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "mansions": "#/components/schemas/mansionIdentifierInRequest", + "residences": "#/components/schemas/residenceIdentifierInRequest", + "roads": "#/components/schemas/roadIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInKitchenResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInLivingRoomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInMansionResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "mansionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryBathroomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBathroomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryBedroomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBedroomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryBuildingResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryCyclePathResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCyclePathResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryDistrictResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInDistrictResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryFamilyHomeResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInFamilyHomeResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryKitchenResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInKitchenResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryLivingRoomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInLivingRoomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryMansionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInMansionResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryResidenceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryRoadResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoadResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryRoomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryToiletResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInToiletResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInCreateBathroomRequest", + "bedrooms": "#/components/schemas/relationshipsInCreateBedroomRequest", + "buildings": "#/components/schemas/relationshipsInCreateBuildingRequest", + "cyclePaths": "#/components/schemas/relationshipsInCreateCyclePathRequest", + "districts": "#/components/schemas/relationshipsInCreateDistrictRequest", + "familyHomes": "#/components/schemas/relationshipsInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/relationshipsInCreateKitchenRequest", + "livingRooms": "#/components/schemas/relationshipsInCreateLivingRoomRequest", + "mansions": "#/components/schemas/relationshipsInCreateMansionRequest", + "residences": "#/components/schemas/relationshipsInCreateResidenceRequest", + "roads": "#/components/schemas/relationshipsInCreateRoadRequest", + "rooms": "#/components/schemas/relationshipsInCreateRoomRequest", + "toilets": "#/components/schemas/relationshipsInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "residence" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInResponse" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "buildings": "#/components/schemas/relationshipsInBuildingResponse", + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse", + "districts": "#/components/schemas/relationshipsInDistrictResponse", + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse", + "roads": "#/components/schemas/relationshipsInRoadResponse", + "rooms": "#/components/schemas/relationshipsInRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + }, + "relationshipsInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInUpdateBathroomRequest", + "bedrooms": "#/components/schemas/relationshipsInUpdateBedroomRequest", + "buildings": "#/components/schemas/relationshipsInUpdateBuildingRequest", + "cyclePaths": "#/components/schemas/relationshipsInUpdateCyclePathRequest", + "districts": "#/components/schemas/relationshipsInUpdateDistrictRequest", + "familyHomes": "#/components/schemas/relationshipsInUpdateFamilyHomeRequest", + "kitchens": "#/components/schemas/relationshipsInUpdateKitchenRequest", + "livingRooms": "#/components/schemas/relationshipsInUpdateLivingRoomRequest", + "mansions": "#/components/schemas/relationshipsInUpdateMansionRequest", + "residences": "#/components/schemas/relationshipsInUpdateResidenceRequest", + "roads": "#/components/schemas/relationshipsInUpdateRoadRequest", + "rooms": "#/components/schemas/relationshipsInUpdateRoomRequest", + "toilets": "#/components/schemas/relationshipsInUpdateToiletRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResidenceResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "residenceIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "residenceIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInCreateBathroomRequest", + "bedrooms": "#/components/schemas/dataInCreateBedroomRequest", + "buildings": "#/components/schemas/dataInCreateBuildingRequest", + "cyclePaths": "#/components/schemas/dataInCreateCyclePathRequest", + "districts": "#/components/schemas/dataInCreateDistrictRequest", + "familyHomes": "#/components/schemas/dataInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/dataInCreateKitchenRequest", + "livingRooms": "#/components/schemas/dataInCreateLivingRoomRequest", + "mansions": "#/components/schemas/dataInCreateMansionRequest", + "residences": "#/components/schemas/dataInCreateResidenceRequest", + "roads": "#/components/schemas/dataInCreateRoadRequest", + "rooms": "#/components/schemas/dataInCreateRoomRequest", + "staffMembers": "#/components/schemas/dataInCreateStaffMemberRequest", + "toilets": "#/components/schemas/dataInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "buildings": "#/components/schemas/dataInBuildingResponse", + "cyclePaths": "#/components/schemas/dataInCyclePathResponse", + "districts": "#/components/schemas/dataInDistrictResponse", + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse", + "roads": "#/components/schemas/dataInRoadResponse", + "rooms": "#/components/schemas/dataInRoomResponse", + "staffMembers": "#/components/schemas/dataInStaffMemberResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInUpdateBathroomRequest", + "bedrooms": "#/components/schemas/dataInUpdateBedroomRequest", + "buildings": "#/components/schemas/dataInUpdateBuildingRequest", + "cyclePaths": "#/components/schemas/dataInUpdateCyclePathRequest", + "districts": "#/components/schemas/dataInUpdateDistrictRequest", + "familyHomes": "#/components/schemas/dataInUpdateFamilyHomeRequest", + "kitchens": "#/components/schemas/dataInUpdateKitchenRequest", + "livingRooms": "#/components/schemas/dataInUpdateLivingRoomRequest", + "mansions": "#/components/schemas/dataInUpdateMansionRequest", + "residences": "#/components/schemas/dataInUpdateResidenceRequest", + "roads": "#/components/schemas/dataInUpdateRoadRequest", + "rooms": "#/components/schemas/dataInUpdateRoomRequest", + "staffMembers": "#/components/schemas/dataInUpdateStaffMemberRequest", + "toilets": "#/components/schemas/dataInUpdateToiletRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "cyclePaths", + "districts", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "roads", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roadCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInRoadResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roadIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roadIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roadIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roadResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/cyclePathIdentifierInResponse" + } + } + }, + "roadResourceType": { + "enum": [ + "cyclePaths", + "roads" + ], + "type": "string" + }, + "roomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInRoomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "secondaryResidenceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyBuildingInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyBuildingInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInToiletResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBathroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBathroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateBedroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBedroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateCyclePathRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateCyclePathRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateDistrictRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateDistrictRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateFamilyHomeRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateFamilyHomeRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateKitchenRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateKitchenRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateLivingRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateLivingRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateMansionRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateMansionRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateResidenceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateRoadRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoadRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateToiletRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateToiletRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsEndpointFilter.cs new file mode 100644 index 0000000000..5b2866d074 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.NoOperations; + +public sealed class NoOperationsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return true; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsInheritanceTests.cs new file mode 100644 index 0000000000..47666a3550 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsInheritanceTests.cs @@ -0,0 +1,331 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.NoOperations; + +public sealed class NoOperationsInheritanceTests : ResourceInheritanceTests +{ + public NoOperationsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : base(testContext, true, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.All)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.All)] + [InlineData(typeof(Building), JsonApiEndpoints.All)] + [InlineData(typeof(Residence), JsonApiEndpoints.All)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.All)] + [InlineData(typeof(Mansion), JsonApiEndpoints.All)] + [InlineData(typeof(Room), JsonApiEndpoints.All)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.All)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.All)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.All)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.All)] + [InlineData(typeof(Toilet), JsonApiEndpoints.All)] + [InlineData(typeof(Road), JsonApiEndpoints.All)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.All)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", "")] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", null)] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", null)] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, null, null)] + [InlineData("createFamilyHomeOperation", false, null, null)] + [InlineData("createMansionOperation", false, null, null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, null, null)] + [InlineData("updateFamilyHomeOperation", false, null, null)] + [InlineData("updateMansionOperation", false, null, null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionStaffRelationshipOperation", false, null, null)] + [InlineData("addToResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionStaffRelationshipOperation", false, null, null)] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, null, null)] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, null, null)] + [InlineData("createBedroomOperation", false, null, null)] + [InlineData("createKitchenOperation", false, null, null)] + [InlineData("createLivingRoomOperation", false, null, null)] + [InlineData("createToiletOperation", false, null, null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBathroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, null, null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, null, null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsOperationFilter.cs new file mode 100644 index 0000000000..4c4f63ef5e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.NoOperations; + +public sealed class NoOperationsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractEndpointFilter.cs new file mode 100644 index 0000000000..29d20e0ab8 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyAbstract; + +internal sealed class OnlyAbstractEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return resourceType.ClrType.IsAbstract; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractInheritanceTests.cs new file mode 100644 index 0000000000..ddcb24baaf --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractInheritanceTests.cs @@ -0,0 +1,335 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyAbstract; + +public sealed class OnlyAbstractInheritanceTests : ResourceInheritanceTests +{ + public OnlyAbstractInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : base(testContext, true, false) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.None)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.All)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.None)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.All)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.None)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("resourceInUpdateRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("identifierInRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + [InlineData("resourceInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, null)] + [InlineData("roadIdentifierInResponse", false, null)] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("attributesInUpdateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("relationshipsInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("relationshipsInUpdateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", null)] + [InlineData("!relationshipsInRoadResponse", null)] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addBuilding|updateBuilding|removeBuilding|" + + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addRoom|updateRoom|removeRoom|updateRoomResidence|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", null)] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, "atomicOperation", "op|data")] + [InlineData("createResidenceOperation", false, "createBuildingOperation", null)] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateResidenceOperation", false, "updateBuildingOperation", null)] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteResidenceOperation", false, "deleteBuildingOperation", null)] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateBedroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateKitchenOperation", false, "updateRoomOperation", null)] + [InlineData("updateLivingRoomOperation", false, "updateRoomOperation", null)] + [InlineData("updateToiletOperation", false, "updateRoomOperation", null)] + [InlineData("deleteRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBathroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteBedroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteKitchenOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteLivingRoomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteToiletOperation", false, "deleteRoomOperation", null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, null, null)] + [InlineData("dataInCyclePathResponse", false, null, null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, null, null)] + [InlineData("attributesInCyclePathResponse", false, null, null)] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, null, null)] + [InlineData("relationshipsInCyclePathResponse", false, null, null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, null, null)] + [InlineData("cyclePathIdentifierInRequest", false, null, null)] + [InlineData("roadIdentifierInResponse", false, null, null)] + [InlineData("cyclePathIdentifierInResponse", false, null, null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractOperationFilter.cs new file mode 100644 index 0000000000..3031856a70 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyAbstract; + +public sealed class OnlyAbstractOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return resourceType.ClrType.IsAbstract ? JsonApiEndpoints.All : JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteEndpointFilter.cs new file mode 100644 index 0000000000..d12808f9c7 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyConcrete; + +internal sealed class OnlyConcreteEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return !resourceType.ClrType.IsAbstract; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteInheritanceTests.cs new file mode 100644 index 0000000000..0e8e30f499 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteInheritanceTests.cs @@ -0,0 +1,346 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyConcrete; + +public sealed class OnlyConcreteInheritanceTests : ResourceInheritanceTests +{ + public OnlyConcreteInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : base(testContext, true, false) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.All)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.All)] + [InlineData(typeof(Building), JsonApiEndpoints.None)] + [InlineData(typeof(Residence), JsonApiEndpoints.All)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.All)] + [InlineData(typeof(Mansion), JsonApiEndpoints.All)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.All)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.All)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.All)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.All)] + [InlineData(typeof(Toilet), JsonApiEndpoints.All)] + [InlineData(typeof(Road), JsonApiEndpoints.All)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.All)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence|" + + "addDistrict|updateDistrict|removeDistrict|addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads|" + + "addRoad|updateRoad|removeRoad|" + + "addCyclePath|updateCyclePath|removeCyclePath|" + + "addStaffMember|updateStaffMember|removeStaffMember" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", "bathrooms")] + [InlineData("bedroomResourceType", "bedrooms")] + [InlineData("kitchenResourceType", "kitchens")] + [InlineData("livingRoomResourceType", "livingRooms")] + [InlineData("toiletResourceType", "toilets")] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, "atomicOperation", "op|data")] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBedroomOperation", false, "atomicOperation", "op|data")] + [InlineData("createKitchenOperation", false, "atomicOperation", "op|data")] + [InlineData("createLivingRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createToiletOperation", false, "atomicOperation", "op|data")] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBedroomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateKitchenOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateLivingRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateToiletOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBedroomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteKitchenOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteLivingRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteToiletOperation", false, "atomicOperation", "op|ref")] + [InlineData("updateRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateToiletResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, "atomicOperation", "op|data")] + [InlineData("createCyclePathOperation", false, "createRoadOperation", null)] + [InlineData("updateRoadOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateCyclePathOperation", false, "updateRoadOperation", null)] + [InlineData("deleteRoadOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteCyclePathOperation", false, "deleteRoadOperation", null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteOperationFilter.cs new file mode 100644 index 0000000000..c29b005b5f --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyConcrete; + +public sealed class OnlyConcreteOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return resourceType.ClrType.IsAbstract ? JsonApiEndpoints.None : JsonApiEndpoints.All; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsEndpointFilter.cs new file mode 100644 index 0000000000..2306a52b98 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyOperations; + +public sealed class OnlyOperationsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return false; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsInheritanceTests.cs new file mode 100644 index 0000000000..f13e5f8c08 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsInheritanceTests.cs @@ -0,0 +1,348 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyOperations; + +public sealed class OnlyOperationsInheritanceTests : ResourceInheritanceTests +{ + public OnlyOperationsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : base(testContext, true, false) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.None)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.None)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.None)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.None)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addBuilding|updateBuilding|removeBuilding|" + + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addRoom|updateRoom|removeRoom|updateRoomResidence|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence|" + + "addDistrict|updateDistrict|removeDistrict|addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads|" + + "addRoad|updateRoad|removeRoad|" + + "addCyclePath|updateCyclePath|removeCyclePath|" + + "addStaffMember|updateStaffMember|removeStaffMember" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, "atomicOperation", "op|data")] + [InlineData("createResidenceOperation", false, "createBuildingOperation", null)] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateResidenceOperation", false, "updateBuildingOperation", null)] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteResidenceOperation", false, "deleteBuildingOperation", null)] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateBedroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateKitchenOperation", false, "updateRoomOperation", null)] + [InlineData("updateLivingRoomOperation", false, "updateRoomOperation", null)] + [InlineData("updateToiletOperation", false, "updateRoomOperation", null)] + [InlineData("deleteRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBathroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteBedroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteKitchenOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteLivingRoomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteToiletOperation", false, "deleteRoomOperation", null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, "atomicOperation", "op|data")] + [InlineData("createCyclePathOperation", false, "createRoadOperation", null)] + [InlineData("updateRoadOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateCyclePathOperation", false, "updateRoadOperation", null)] + [InlineData("deleteRoadOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteCyclePathOperation", false, "deleteRoadOperation", null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsOperationFilter.cs new file mode 100644 index 0000000000..d919512f97 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyOperations; + +public sealed class OnlyOperationsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return JsonApiEndpoints.All; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..c9cdbea0b0 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json @@ -0,0 +1,6194 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/bathrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship.", + "operationId": "getBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bathrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bathroom.", + "operationId": "patchBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship.", + "operationId": "getBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bedrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bedroom.", + "operationId": "patchBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/relationships/buildings": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship.", + "operationId": "getDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found building identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing buildings to the buildings relationship of an individual district.", + "operationId": "postDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add buildings to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to add to the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing buildings to the buildings relationship of an individual district.", + "operationId": "patchDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose buildings relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to assign to the buildings relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing buildings from the buildings relationship of an individual district.", + "operationId": "deleteDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove buildings from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to remove from the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/relationships/roads": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship.", + "operationId": "getDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found road identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing roads to the roads relationship of an individual district.", + "operationId": "postDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add roads to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to add to the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing roads to the roads relationship of an individual district.", + "operationId": "patchDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose roads relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to assign to the roads relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing roads from the roads relationship of an individual district.", + "operationId": "deleteDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove roads from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to remove from the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes/{id}/relationships/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + }, + "post": { + "tags": [ + "familyHomes" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "postFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "familyHomes" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "patchFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "familyHomes" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual familyHome.", + "operationId": "deleteFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens/{id}/relationships/residence": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship.", + "operationId": "getKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + }, + "patch": { + "tags": [ + "kitchens" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual kitchen.", + "operationId": "patchKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms/{id}/relationships/residence": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship.", + "operationId": "getLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + }, + "patch": { + "tags": [ + "livingRooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual livingRoom.", + "operationId": "patchLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/relationships/rooms": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship.", + "operationId": "getMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual mansion.", + "operationId": "postMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual mansion.", + "operationId": "patchMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual mansion.", + "operationId": "deleteMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/relationships/staff": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship.", + "operationId": "getMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "postMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add staffMembers to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to add to the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "patchMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose staff relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to assign to the staff relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staff relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing staffMembers from the staff relationship of an individual mansion.", + "operationId": "deleteMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove staffMembers from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to remove from the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences/{id}/relationships/rooms": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship.", + "operationId": "getResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + }, + "post": { + "tags": [ + "residences" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual residence.", + "operationId": "postResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "residences" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual residence.", + "operationId": "patchResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "residences" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual residence.", + "operationId": "deleteResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms/{id}/relationships/residence": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship.", + "operationId": "getRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + }, + "patch": { + "tags": [ + "rooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual room.", + "operationId": "patchRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets/{id}/relationships/residence": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship.", + "operationId": "getToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + }, + "patch": { + "tags": [ + "toilets" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual toilet.", + "operationId": "patchToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "addOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "addToDistrictBuildingsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToDistrictRoadsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/addToResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/addToResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToResidenceRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addToDistrictBuildings": "#/components/schemas/addToDistrictBuildingsRelationshipOperation", + "addToDistrictRoads": "#/components/schemas/addToDistrictRoadsRelationshipOperation", + "addToFamilyHomeRooms": "#/components/schemas/addToFamilyHomeRoomsRelationshipOperation", + "addToMansionRooms": "#/components/schemas/addToMansionRoomsRelationshipOperation", + "addToMansionStaff": "#/components/schemas/addToMansionStaffRelationshipOperation", + "addToResidenceRooms": "#/components/schemas/addToResidenceRoomsRelationshipOperation", + "removeFromDistrictBuildings": "#/components/schemas/removeFromDistrictBuildingsRelationshipOperation", + "removeFromDistrictRoads": "#/components/schemas/removeFromDistrictRoadsRelationshipOperation", + "removeFromFamilyHomeRooms": "#/components/schemas/removeFromFamilyHomeRoomsRelationshipOperation", + "removeFromMansionRooms": "#/components/schemas/removeFromMansionRoomsRelationshipOperation", + "removeFromMansionStaff": "#/components/schemas/removeFromMansionStaffRelationshipOperation", + "removeFromResidenceRooms": "#/components/schemas/removeFromResidenceRoomsRelationshipOperation", + "updateBathroomResidence": "#/components/schemas/updateBathroomResidenceRelationshipOperation", + "updateBedroomResidence": "#/components/schemas/updateBedroomResidenceRelationshipOperation", + "updateDistrictBuildings": "#/components/schemas/updateDistrictBuildingsRelationshipOperation", + "updateDistrictRoads": "#/components/schemas/updateDistrictRoadsRelationshipOperation", + "updateFamilyHomeRooms": "#/components/schemas/updateFamilyHomeRoomsRelationshipOperation", + "updateKitchenResidence": "#/components/schemas/updateKitchenResidenceRelationshipOperation", + "updateLivingRoomResidence": "#/components/schemas/updateLivingRoomResidenceRelationshipOperation", + "updateMansionRooms": "#/components/schemas/updateMansionRoomsRelationshipOperation", + "updateMansionStaff": "#/components/schemas/updateMansionStaffRelationshipOperation", + "updateResidenceRooms": "#/components/schemas/updateResidenceRoomsRelationshipOperation", + "updateRoomResidence": "#/components/schemas/updateRoomResidenceRelationshipOperation", + "updateToiletResidence": "#/components/schemas/updateToiletResidenceRelationshipOperation" + } + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "buildingIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "cyclePathIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "cyclePathIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "districtBuildingsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/districtResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "districtBuildingsRelationshipName": { + "enum": [ + "buildings" + ], + "type": "string" + }, + "districtResourceType": { + "enum": [ + "districts" + ], + "type": "string" + }, + "districtRoadsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/districtResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "districtRoadsRelationshipName": { + "enum": [ + "roads" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "buildings": "#/components/schemas/buildingIdentifierInRequest", + "cyclePaths": "#/components/schemas/cyclePathIdentifierInRequest", + "familyHomes": "#/components/schemas/familyHomeIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "mansions": "#/components/schemas/mansionIdentifierInRequest", + "residences": "#/components/schemas/residenceIdentifierInRequest", + "roads": "#/components/schemas/roadIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionResourceType": { + "enum": [ + "mansions" + ], + "type": "string" + }, + "mansionStaffRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "mansionStaffRelationshipName": { + "enum": [ + "staff" + ], + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "removeFromDistrictBuildingsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromDistrictRoadsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/removeFromResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/removeFromResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromResidenceRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "residenceIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "residenceIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "residenceResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "residenceRoomsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "residenceRoomsRelationshipName": { + "enum": [ + "rooms" + ], + "type": "string" + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type" + }, + "x-abstract": true + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "cyclePaths", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "roads", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roadIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roadIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roadIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roadResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/cyclePathIdentifierInResponse" + } + } + }, + "roadResourceType": { + "enum": [ + "cyclePaths", + "roads" + ], + "type": "string" + }, + "roomIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResidenceRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "roomResidenceRelationshipName": { + "enum": [ + "residence" + ], + "type": "string" + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "staffMemberIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyBuildingInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBathroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBedroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateDistrictBuildingsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateDistrictRoadsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateKitchenResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateLivingRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "updateResidenceRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateToiletResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsEndpointFilter.cs new file mode 100644 index 0000000000..2425c64fb3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsEndpointFilter.cs @@ -0,0 +1,18 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyRelationships; + +public sealed class OnlyRelationshipsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return endpoint switch + { + JsonApiEndpoints.GetRelationship or JsonApiEndpoints.PostRelationship or JsonApiEndpoints.PatchRelationship or + JsonApiEndpoints.DeleteRelationship => true, + _ => false + }; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsInheritanceTests.cs new file mode 100644 index 0000000000..49d5d48333 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsInheritanceTests.cs @@ -0,0 +1,340 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyRelationships; + +public sealed class OnlyRelationshipsInheritanceTests : ResourceInheritanceTests +{ + private const JsonApiEndpoints OnlyRelationshipEndpoints = JsonApiEndpoints.GetRelationship | JsonApiEndpoints.PostRelationship | + JsonApiEndpoints.PatchRelationship | JsonApiEndpoints.DeleteRelationship; + + public OnlyRelationshipsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : base(testContext, true, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), OnlyRelationshipEndpoints)] + [InlineData(typeof(StaffMember), OnlyRelationshipEndpoints)] + [InlineData(typeof(Building), OnlyRelationshipEndpoints)] + [InlineData(typeof(Residence), OnlyRelationshipEndpoints)] + [InlineData(typeof(FamilyHome), OnlyRelationshipEndpoints)] + [InlineData(typeof(Mansion), OnlyRelationshipEndpoints)] + [InlineData(typeof(Room), OnlyRelationshipEndpoints)] + [InlineData(typeof(Kitchen), OnlyRelationshipEndpoints)] + [InlineData(typeof(Bedroom), OnlyRelationshipEndpoints)] + [InlineData(typeof(Bathroom), OnlyRelationshipEndpoints)] + [InlineData(typeof(LivingRoom), OnlyRelationshipEndpoints)] + [InlineData(typeof(Toilet), OnlyRelationshipEndpoints)] + [InlineData(typeof(Road), OnlyRelationshipEndpoints)] + [InlineData(typeof(CyclePath), OnlyRelationshipEndpoints)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, null)] + [InlineData("resourceInUpdateRequest", false, null)] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, "")] + [InlineData("dataInBuildingResponse", true, null)] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, null)] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, null)] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, null)] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", null)] + [InlineData("attributesInUpdateRequest", null)] + [InlineData("relationshipsInCreateRequest", null)] + [InlineData("relationshipsInUpdateRequest", null)] + [InlineData("!attributesInBuildingResponse", null)] + [InlineData("!relationshipsInBuildingResponse", null)] + [InlineData("!attributesInRoomResponse", null)] + [InlineData("!relationshipsInRoomResponse", null)] + [InlineData("!attributesInRoadResponse", null)] + [InlineData("!relationshipsInRoadResponse", null)] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "updateRoomResidence|" + + "updateBathroomResidence|" + + "updateBedroomResidence|" + + "updateKitchenResidence|" + + "updateLivingRoomResidence|" + + "updateToiletResidence|" + + "addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, null)] + [InlineData("attributesInCreateRequest", true, null, null)] + [InlineData("relationshipsInCreateRequest", true, null, null)] + [InlineData("resourceInUpdateRequest", true, null, null)] + [InlineData("attributesInUpdateRequest", true, null, null)] + [InlineData("relationshipsInUpdateRequest", true, null, null)] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, null, null)] + [InlineData("dataInCreateResidenceRequest", false, null, null)] + [InlineData("dataInCreateFamilyHomeRequest", false, null, null)] + [InlineData("dataInCreateMansionRequest", false, null, null)] + [InlineData("dataInUpdateBuildingRequest", true, null, null)] + [InlineData("dataInUpdateResidenceRequest", false, null, null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, null, null)] + [InlineData("dataInUpdateMansionRequest", false, null, null)] + [InlineData("dataInBuildingResponse", true, null, null)] + [InlineData("dataInResidenceResponse", false, null, null)] + [InlineData("dataInFamilyHomeResponse", false, null, null)] + [InlineData("dataInMansionResponse", false, null, null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, null, null)] + [InlineData("attributesInCreateResidenceRequest", false, null, null)] + [InlineData("attributesInCreateFamilyHomeRequest", false, null, null)] + [InlineData("attributesInCreateMansionRequest", false, null, null)] + [InlineData("attributesInUpdateBuildingRequest", true, null, null)] + [InlineData("attributesInUpdateResidenceRequest", false, null, null)] + [InlineData("attributesInUpdateFamilyHomeRequest", false, null, null)] + [InlineData("attributesInUpdateMansionRequest", false, null, null)] + [InlineData("attributesInBuildingResponse", true, null, null)] + [InlineData("attributesInResidenceResponse", false, null, null)] + [InlineData("attributesInFamilyHomeResponse", false, null, null)] + [InlineData("attributesInMansionResponse", false, null, null)] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, null, null)] + [InlineData("relationshipsInCreateResidenceRequest", false, null, null)] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, null, null)] + [InlineData("relationshipsInCreateMansionRequest", false, null, null)] + [InlineData("relationshipsInUpdateBuildingRequest", true, null, null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, null, null)] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, null, null)] + [InlineData("relationshipsInUpdateMansionRequest", false, null, null)] + [InlineData("relationshipsInBuildingResponse", true, null, null)] + [InlineData("relationshipsInResidenceResponse", false, null, null)] + [InlineData("relationshipsInFamilyHomeResponse", false, null, null)] + [InlineData("relationshipsInMansionResponse", false, null, null)] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, null, null)] + [InlineData("createFamilyHomeOperation", false, null, null)] + [InlineData("createMansionOperation", false, null, null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, null, null)] + [InlineData("updateFamilyHomeOperation", false, null, null)] + [InlineData("updateMansionOperation", false, null, null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, null, null)] + [InlineData("dataInCreateBathroomRequest", false, null, null)] + [InlineData("dataInCreateBedroomRequest", false, null, null)] + [InlineData("dataInCreateKitchenRequest", false, null, null)] + [InlineData("dataInCreateLivingRoomRequest", false, null, null)] + [InlineData("dataInCreateToiletRequest", false, null, null)] + [InlineData("dataInUpdateRoomRequest", true, null, null)] + [InlineData("dataInUpdateBathroomRequest", false, null, null)] + [InlineData("dataInUpdateBedroomRequest", false, null, null)] + [InlineData("dataInUpdateKitchenRequest", false, null, null)] + [InlineData("dataInUpdateLivingRoomRequest", false, null, null)] + [InlineData("dataInUpdateToiletRequest", false, null, null)] + [InlineData("dataInRoomResponse", true, null, null)] + [InlineData("dataInBathroomResponse", false, null, null)] + [InlineData("dataInBedroomResponse", false, null, null)] + [InlineData("dataInKitchenResponse", false, null, null)] + [InlineData("dataInLivingRoomResponse", false, null, null)] + [InlineData("dataInToiletResponse", false, null, null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, null, null)] + [InlineData("attributesInCreateBathroomRequest", false, null, null)] + [InlineData("attributesInCreateBedroomRequest", false, null, null)] + [InlineData("attributesInCreateKitchenRequest", false, null, null)] + [InlineData("attributesInCreateLivingRoomRequest", false, null, null)] + [InlineData("attributesInCreateToiletRequest", false, null, null)] + [InlineData("attributesInUpdateRoomRequest", true, null, null)] + [InlineData("attributesInUpdateBathroomRequest", false, null, null)] + [InlineData("attributesInUpdateBedroomRequest", false, null, null)] + [InlineData("attributesInUpdateKitchenRequest", false, null, null)] + [InlineData("attributesInUpdateLivingRoomRequest", false, null, null)] + [InlineData("attributesInUpdateToiletRequest", false, null, null)] + [InlineData("attributesInRoomResponse", true, null, null)] + [InlineData("attributesInBathroomResponse", false, null, null)] + [InlineData("attributesInBedroomResponse", false, null, null)] + [InlineData("attributesInKitchenResponse", false, null, null)] + [InlineData("attributesInLivingRoomResponse", false, null, null)] + [InlineData("attributesInToiletResponse", false, null, null)] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, null, null)] + [InlineData("relationshipsInCreateBathroomRequest", false, null, null)] + [InlineData("relationshipsInCreateBedroomRequest", false, null, null)] + [InlineData("relationshipsInCreateKitchenRequest", false, null, null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInCreateToiletRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoomRequest", true, null, null)] + [InlineData("relationshipsInUpdateBathroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, null, null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInUpdateToiletRequest", false, null, null)] + [InlineData("relationshipsInRoomResponse", true, null, null)] + [InlineData("relationshipsInBathroomResponse", false, null, null)] + [InlineData("relationshipsInBedroomResponse", false, null, null)] + [InlineData("relationshipsInKitchenResponse", false, null, null)] + [InlineData("relationshipsInLivingRoomResponse", false, null, null)] + [InlineData("relationshipsInToiletResponse", false, null, null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, null, null)] + [InlineData("createBedroomOperation", false, null, null)] + [InlineData("createKitchenOperation", false, null, null)] + [InlineData("createLivingRoomOperation", false, null, null)] + [InlineData("createToiletOperation", false, null, null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, null, null)] + [InlineData("dataInCyclePathResponse", false, null, null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, null, null)] + [InlineData("attributesInCyclePathResponse", false, null, null)] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, null, null)] + [InlineData("relationshipsInCyclePathResponse", false, null, null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsOperationFilter.cs new file mode 100644 index 0000000000..528990caa3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyRelationships; + +public sealed class OnlyRelationshipsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return JsonApiEndpoints.GetRelationship | JsonApiEndpoints.PostRelationship | JsonApiEndpoints.PatchRelationship | JsonApiEndpoints.DeleteRelationship; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OperationsController.cs b/test/OpenApiTests/ResourceInheritance/OperationsController.cs new file mode 100644 index 0000000000..ba56ca89b2 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OperationsController.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.ResourceInheritance; + +public sealed class OperationsController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IOperationsProcessor processor, IJsonApiRequest request, + ITargetedFields targetedFields, IAtomicOperationFilter operationFilter) + : JsonApiOperationsController(options, resourceGraph, loggerFactory, processor, request, targetedFields, operationFilter); diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceControllerExtensions.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceControllerExtensions.cs new file mode 100644 index 0000000000..8856301cb9 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceControllerExtensions.cs @@ -0,0 +1,35 @@ +using TestBuildingBlocks; + +namespace OpenApiTests.ResourceInheritance; + +public static class ResourceInheritanceControllerExtensions +{ + public static void UseInheritanceControllers( + this IntegrationTestContext, ResourceInheritanceDbContext> testContext, bool hasOperationsController) + { + ArgumentNullException.ThrowIfNull(testContext); + + testContext.UseController(); + testContext.UseController(); + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.UseController(); + testContext.UseController(); + + if (hasOperationsController) + { + testContext.UseController(); + } + } +} diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceDbContext.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceDbContext.cs new file mode 100644 index 0000000000..182282bf87 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceDbContext.cs @@ -0,0 +1,29 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using OpenApiTests.ResourceInheritance.Models; +using TestBuildingBlocks; + +namespace OpenApiTests.ResourceInheritance; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ResourceInheritanceDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Districts => Set(); + public DbSet StaffMembers => Set(); + + public DbSet Buildings => Set(); + public DbSet Residences => Set(); + public DbSet FamilyHomes => Set(); + public DbSet Mansions => Set(); + + public DbSet Rooms => Set(); + public DbSet Kitchens => Set(); + public DbSet Bedrooms => Set(); + public DbSet Bathrooms => Set(); + public DbSet LivingRooms => Set(); + public DbSet Toilets => Set(); + + public DbSet Roads => Set(); + public DbSet CyclePaths => Set(); +} diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceFakers.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceFakers.cs new file mode 100644 index 0000000000..2e45c2bf0e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceFakers.cs @@ -0,0 +1,85 @@ +using Bogus; +using JetBrains.Annotations; +using OpenApiTests.ResourceInheritance.Models; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.ResourceInheritance; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ResourceInheritanceFakers +{ + private readonly Lazy> _lazyDistrictFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(district => district.Name, faker => faker.Address.County())); + + private readonly Lazy> _lazyStaffMemberFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(staffMember => staffMember.Name, faker => faker.Person.FullName)); + + private readonly Lazy> _lazyResidenceFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(residence => residence.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(residence => residence.NumberOfResidents, faker => faker.Random.Int(0, 15))); + + private readonly Lazy> _lazyMansionFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(mansion => mansion.SurfaceInSquareMeters, faker => faker.Random.Int(500, 2500)) + .RuleFor(mansion => mansion.NumberOfResidents, faker => faker.Random.Int(0, 150)) + .RuleFor(mansion => mansion.OwnerName, faker => faker.Person.FullName)); + + private readonly Lazy> _lazyFamilyHomeFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(familyHome => familyHome.SurfaceInSquareMeters, faker => faker.Random.Int(500, 2500)) + .RuleFor(familyHome => familyHome.NumberOfResidents, faker => faker.Random.Int(0, 150)) + .RuleFor(familyHome => familyHome.FloorCount, faker => faker.Random.Int(1, 4))); + + private readonly Lazy> _lazyKitchenFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(kitchen => kitchen.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(kitchen => kitchen.HasPantry, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyBedroomFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(bedroom => bedroom.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(bedroom => bedroom.BedCount, faker => faker.Random.Int(1, 5))); + + private readonly Lazy> _lazyBathroomFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(bathroom => bathroom.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(bathroom => bathroom.HasBath, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyLivingRoomFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(livingRoom => livingRoom.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(livingRoom => livingRoom.HasDiningTable, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyToiletFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(toilet => toilet.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(toilet => toilet.HasSink, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyRoadFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(road => road.LengthInMeters, faker => faker.Random.Int(20, 2500))); + + private readonly Lazy> _lazyCyclePathFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(cyclePath => cyclePath.LengthInMeters, faker => faker.Random.Int(20, 2500)) + .RuleFor(cyclePath => cyclePath.HasLaneForPedestrians, faker => faker.Random.Bool())); + + public Faker District => _lazyDistrictFaker.Value; + public Faker StaffMember => _lazyStaffMemberFaker.Value; + public Faker Residence => _lazyResidenceFaker.Value; + public Faker FamilyHome => _lazyFamilyHomeFaker.Value; + public Faker Mansion => _lazyMansionFaker.Value; + public Faker Kitchen => _lazyKitchenFaker.Value; + public Faker Bedroom => _lazyBedroomFaker.Value; + public Faker Bathroom => _lazyBathroomFaker.Value; + public Faker LivingRoom => _lazyLivingRoomFaker.Value; + public Faker Toilet => _lazyToiletFaker.Value; + public Faker Road => _lazyRoadFaker.Value; + public Faker CyclePath => _lazyCyclePathFaker.Value; +} diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs new file mode 100644 index 0000000000..f2c05660f6 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs @@ -0,0 +1,254 @@ +using System.Collections.ObjectModel; +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using Microsoft.Extensions.DependencyInjection; +using TestBuildingBlocks; +using Xunit; + +#pragma warning disable AV1755 // Name of async method should end with Async or TaskAsync + +namespace OpenApiTests.ResourceInheritance; + +public abstract class ResourceInheritanceTests : IClassFixture, ResourceInheritanceDbContext>> +{ + private readonly OpenApiTestContext, ResourceInheritanceDbContext> _testContext; + + protected ResourceInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + bool hasOperationsController, bool writeToDisk) + { + _testContext = testContext; + + testContext.UseInheritanceControllers(hasOperationsController); + + if (writeToDisk) + { + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + } + + public virtual async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + // Arrange + var resourceGraph = _testContext.Factory.Services.GetRequiredService(); + ResourceType resourceType = resourceGraph.GetResourceType(resourceClrType); + IReadOnlyDictionary> endpointToPathMap = JsonPathBuilder.GetEndpointPaths(resourceType); + + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string[] pathsExpected = JsonPathBuilder.KnownEndpoints.Where(endpoint => expected.HasFlag(endpoint)) + .SelectMany(endpoint => endpointToPathMap[endpoint]).ToArray(); + + string[] pathsNotExpected = endpointToPathMap.Values.SelectMany(paths => paths).Except(pathsExpected).ToArray(); + + foreach (string path in pathsExpected) + { + document.Should().ContainPath(path); + } + + foreach (string path in pathsNotExpected) + { + document.Should().NotContainPath(path); + } + } + + public virtual async Task Operations_endpoint_is_exposed(bool enabled) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (enabled) + { + document.Should().ContainPath("paths./operations.post"); + } + else + { + document.Should().NotContainPath("paths./operations.post"); + } + } + + public virtual async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (discriminatorValues == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + string schemaPath = isWrapped ? $"components.schemas.{schemaName}.allOf[1]" : $"components.schemas.{schemaName}"; + + document.Should().ContainPath(schemaPath).With(schemaElement => + { + schemaElement.Should().ContainPath("discriminator").With(discriminatorElement => + { + discriminatorElement.Should().HaveProperty("propertyName", "type"); + + if (discriminatorValues.Length == 0) + { + discriminatorElement.Should().NotContainPath("mapping"); + } + else + { + discriminatorElement.Should().ContainPath("mapping").With(mappingElement => + { + string[] valueArray = discriminatorValues.Split('|'); + mappingElement.EnumerateObject().Should().HaveCount(valueArray.Length); + + foreach (string value in valueArray) + { + mappingElement.Should().ContainProperty(value); + } + }); + } + }); + }); + } + } + + public virtual async Task Expected_names_appear_in_openapi_discriminator_mapping(string prefixedSchemaName, string? discriminatorValues) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + string schemaName = prefixedSchemaName.StartsWith('!') ? prefixedSchemaName[1..] : prefixedSchemaName; + string discriminatorPath = prefixedSchemaName.StartsWith('!') ? "allOf[1].discriminator" : "discriminator"; + + // Assert + if (discriminatorValues == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + document.Should().ContainPath($"components.schemas.{schemaName}").With(schemaElement => + { + schemaElement.Should().ContainPath(discriminatorPath).With(discriminatorElement => + { + discriminatorElement.Should().HaveProperty("propertyName", "openapi:discriminator"); + + if (discriminatorValues.Length == 0) + { + discriminatorElement.Should().NotContainPath("mapping"); + } + else + { + discriminatorElement.Should().ContainPath("mapping").With(mappingElement => + { + string[] valueArray = discriminatorValues.Split('|'); + mappingElement.EnumerateObject().Should().HaveCount(valueArray.Length); + + foreach (string value in valueArray) + { + mappingElement.Should().ContainProperty(value); + } + }); + } + }); + }); + } + } + + public virtual async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (enumValues == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + document.Should().ContainPath($"components.schemas.{schemaName}").With(schemaElement => + { + if (enumValues.Length == 0) + { + schemaElement.Should().NotContainPath("enum"); + } + else + { + schemaElement.Should().ContainPath("enum").With(enumElement => + { + string[] valueArray = enumValues.Split('|'); + enumElement.EnumerateArray().Should().HaveCount(valueArray.Length); + + foreach (string value in valueArray) + { + enumElement.Should().ContainArrayElement(value); + } + }); + } + }); + } + } + + public virtual async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (baseType == null && properties == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + document.Should().ContainPath($"components.schemas.{schemaName}").With(schemaElement => + { + if (baseType == null) + { + schemaElement.Should().NotContainPath("allOf[0]"); + } + else + { + schemaElement.Should().HaveProperty("allOf[0].$ref", $"#/components/schemas/{baseType}"); + } + + string propertiesPath = baseType != null ? "allOf[1].properties" : "properties"; + + if (properties == null) + { + schemaElement.Should().NotContainPath(propertiesPath); + } + else + { + string[] propertyArray = properties.Split('|'); + + schemaElement.Should().ContainPath(propertiesPath).With(propertiesElement => + { + propertiesElement.EnumerateObject().Should().HaveCount(propertyArray.Length); + + foreach (string value in propertyArray) + { + propertiesElement.Should().ContainProperty(value); + } + }); + } + + string abstractPath = baseType != null ? "allOf[1].x-abstract" : "x-abstract"; + + if (!isAbstract) + { + schemaElement.Should().NotContainPath(abstractPath); + } + else + { + schemaElement.Should().ContainPath(abstractPath).With(abstractElement => + { + abstractElement.Should().Be(true); + }); + } + }); + } + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..88e0ed9f8d --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json @@ -0,0 +1,3258 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "addOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "addToFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/familyHomeRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addBathroom": "#/components/schemas/createBathroomOperation", + "addBedroom": "#/components/schemas/createBedroomOperation", + "addFamilyHome": "#/components/schemas/createFamilyHomeOperation", + "addKitchen": "#/components/schemas/createKitchenOperation", + "addLivingRoom": "#/components/schemas/createLivingRoomOperation", + "addMansion": "#/components/schemas/createMansionOperation", + "addResidence": "#/components/schemas/createResidenceOperation", + "addRoom": "#/components/schemas/createRoomOperation", + "addToFamilyHomeRooms": "#/components/schemas/addToFamilyHomeRoomsRelationshipOperation", + "addToilet": "#/components/schemas/createToiletOperation", + "removeFromMansionRooms": "#/components/schemas/removeFromMansionRoomsRelationshipOperation", + "removeFromMansionStaff": "#/components/schemas/removeFromMansionStaffRelationshipOperation", + "updateBathroomResidence": "#/components/schemas/updateBathroomResidenceRelationshipOperation", + "updateBedroomResidence": "#/components/schemas/updateBedroomResidenceRelationshipOperation", + "updateFamilyHome": "#/components/schemas/updateFamilyHomeOperation", + "updateKitchenResidence": "#/components/schemas/updateKitchenResidenceRelationshipOperation", + "updateLivingRoomResidence": "#/components/schemas/updateLivingRoomResidenceRelationshipOperation", + "updateMansion": "#/components/schemas/updateMansionOperation", + "updateResidence": "#/components/schemas/updateResidenceOperation", + "updateRoomResidence": "#/components/schemas/updateRoomResidenceRelationshipOperation", + "updateToiletResidence": "#/components/schemas/updateToiletResidenceRelationshipOperation" + } + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributesInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasBath" + ], + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "bedCount" + ], + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasPantry" + ], + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasDiningTable" + ], + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "required": [ + "ownerName" + ], + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInCreateBathroomRequest", + "bedrooms": "#/components/schemas/attributesInCreateBedroomRequest", + "buildings": "#/components/schemas/attributesInCreateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/attributesInCreateKitchenRequest", + "livingRooms": "#/components/schemas/attributesInCreateLivingRoomRequest", + "mansions": "#/components/schemas/attributesInCreateMansionRequest", + "residences": "#/components/schemas/attributesInCreateResidenceRequest", + "rooms": "#/components/schemas/attributesInCreateRoomRequest", + "toilets": "#/components/schemas/attributesInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + }, + { + "required": [ + "numberOfResidents" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasSink" + ], + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "buildings": "#/components/schemas/attributesInBuildingResponse", + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse", + "rooms": "#/components/schemas/attributesInRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + }, + "attributesInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/attributesInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/attributesInUpdateMansionRequest", + "residences": "#/components/schemas/attributesInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "createBathroomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createBedroomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createFamilyHomeOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createKitchenOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createLivingRoomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createMansionOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResidenceOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createRoomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createToiletOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateBathroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBedroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateKitchenRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateLivingRoomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateToiletRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeResourceType": { + "enum": [ + "familyHomes" + ], + "type": "string" + }, + "familyHomeRoomsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/familyHomeResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/familyHomeRoomsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "familyHomeRoomsRelationshipName": { + "enum": [ + "rooms" + ], + "type": "string" + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "buildings": "#/components/schemas/buildingIdentifierInRequest", + "familyHomes": "#/components/schemas/familyHomeIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "mansions": "#/components/schemas/mansionIdentifierInRequest", + "residences": "#/components/schemas/residenceIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionResourceType": { + "enum": [ + "mansions" + ], + "type": "string" + }, + "mansionRoomsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionRoomsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "mansionRoomsRelationshipName": { + "enum": [ + "rooms" + ], + "type": "string" + }, + "mansionStaffRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "mansionStaffRelationshipName": { + "enum": [ + "staff" + ], + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInCreateBathroomRequest", + "bedrooms": "#/components/schemas/relationshipsInCreateBedroomRequest", + "buildings": "#/components/schemas/relationshipsInCreateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/relationshipsInCreateKitchenRequest", + "livingRooms": "#/components/schemas/relationshipsInCreateLivingRoomRequest", + "mansions": "#/components/schemas/relationshipsInCreateMansionRequest", + "residences": "#/components/schemas/relationshipsInCreateResidenceRequest", + "rooms": "#/components/schemas/relationshipsInCreateRoomRequest", + "toilets": "#/components/schemas/relationshipsInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "residence" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "buildings": "#/components/schemas/relationshipsInBuildingResponse", + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse", + "rooms": "#/components/schemas/relationshipsInRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + }, + "relationshipsInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/relationshipsInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/relationshipsInUpdateMansionRequest", + "residences": "#/components/schemas/relationshipsInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "residenceIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInCreateBathroomRequest", + "bedrooms": "#/components/schemas/dataInCreateBedroomRequest", + "buildings": "#/components/schemas/dataInCreateBuildingRequest", + "familyHomes": "#/components/schemas/dataInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/dataInCreateKitchenRequest", + "livingRooms": "#/components/schemas/dataInCreateLivingRoomRequest", + "mansions": "#/components/schemas/dataInCreateMansionRequest", + "residences": "#/components/schemas/dataInCreateResidenceRequest", + "rooms": "#/components/schemas/dataInCreateRoomRequest", + "toilets": "#/components/schemas/dataInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "buildings": "#/components/schemas/dataInBuildingResponse", + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse", + "rooms": "#/components/schemas/dataInRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "buildings": "#/components/schemas/dataInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/dataInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/dataInUpdateMansionRequest", + "residences": "#/components/schemas/dataInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResidenceRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "roomResidenceRelationshipName": { + "enum": [ + "residence" + ], + "type": "string" + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBathroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBedroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateFamilyHomeOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateKitchenResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateLivingRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateMansionOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "updateResidenceOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateToiletResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsEndpointFilter.cs new file mode 100644 index 0000000000..ebeb7e0018 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.SubsetOfOperations; + +public sealed class SubsetOfOperationsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return false; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsInheritanceTests.cs new file mode 100644 index 0000000000..5496f98956 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsInheritanceTests.cs @@ -0,0 +1,339 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.SubsetOfOperations; + +public sealed class SubsetOfOperationsInheritanceTests : ResourceInheritanceTests +{ + public SubsetOfOperationsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : base(testContext, true, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.None)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.None)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.None)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.None)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("resourceInUpdateRequest", false, "familyHomes|mansions|residences|buildings")] + [InlineData("identifierInRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + [InlineData("resourceInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, null)] + [InlineData("roadIdentifierInResponse", false, null)] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("attributesInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("relationshipsInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("relationshipsInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", null)] + [InlineData("!relationshipsInRoadResponse", null)] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "" + + "addResidence|updateResidence|" + + "addFamilyHome|updateFamilyHome|addToFamilyHomeRooms|" + + "addMansion|updateMansion|removeFromMansionRooms|removeFromMansionStaff|" + + "addRoom|updateRoomResidence|" + + "addBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToiletResidence" + + "" + + "" + + "" + + "" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", null)] + [InlineData("familyHomeResourceType", "familyHomes")] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", null)] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, "atomicOperation", "op|data")] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionStaffRelationshipOperation", false, null, null)] + [InlineData("addToResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionStaffRelationshipOperation", false, null, null)] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, null, null)] + [InlineData("dataInUpdateBathroomRequest", false, null, null)] + [InlineData("dataInUpdateBedroomRequest", false, null, null)] + [InlineData("dataInUpdateKitchenRequest", false, null, null)] + [InlineData("dataInUpdateLivingRoomRequest", false, null, null)] + [InlineData("dataInUpdateToiletRequest", false, null, null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, null, null)] + [InlineData("attributesInUpdateBathroomRequest", false, null, null)] + [InlineData("attributesInUpdateBedroomRequest", false, null, null)] + [InlineData("attributesInUpdateKitchenRequest", false, null, null)] + [InlineData("attributesInUpdateLivingRoomRequest", false, null, null)] + [InlineData("attributesInUpdateToiletRequest", false, null, null)] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, null, null)] + [InlineData("relationshipsInUpdateBathroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, null, null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInUpdateToiletRequest", false, null, null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, null, null)] + [InlineData("dataInCyclePathResponse", false, null, null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, null, null)] + [InlineData("attributesInCyclePathResponse", false, null, null)] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, null, null)] + [InlineData("relationshipsInCyclePathResponse", false, null, null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, null, null)] + [InlineData("cyclePathIdentifierInRequest", false, null, null)] + [InlineData("roadIdentifierInResponse", false, null, null)] + [InlineData("cyclePathIdentifierInResponse", false, null, null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsOperationFilter.cs new file mode 100644 index 0000000000..0636b46e47 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsOperationFilter.cs @@ -0,0 +1,36 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using OpenApiTests.ResourceInheritance.Models; + +namespace OpenApiTests.ResourceInheritance.SubsetOfOperations; + +public sealed class SubsetOfOperationsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + Type resourceClrType = resourceType.ClrType; + + if (resourceClrType == typeof(Residence)) + { + return JsonApiEndpoints.Post | JsonApiEndpoints.Patch; + } + + if (resourceClrType == typeof(FamilyHome)) + { + return JsonApiEndpoints.GetRelationship | JsonApiEndpoints.PostRelationship; + } + + if (resourceClrType == typeof(Mansion)) + { + return JsonApiEndpoints.DeleteRelationship; + } + + if (resourceClrType == typeof(Room)) + { + return JsonApiEndpoints.Post | JsonApiEndpoints.PatchRelationship; + } + + return JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..42301a5d4d --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json @@ -0,0 +1,3369 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/buildings": { + "post": { + "tags": [ + "buildings" + ], + "summary": "Creates a new building.", + "operationId": "postBuilding", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The building was successfully created, which resulted in additional changes. The newly created building is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created building can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/buildings/{id}": { + "patch": { + "tags": [ + "buildings" + ], + "summary": "Updates an existing building.", + "operationId": "patchBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The building was successfully updated, which resulted in additional changes. The updated building is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The building or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/cyclePaths/{id}": { + "get": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier.", + "operationId": "getCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found cyclePath.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The cyclePath does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The cyclePath does not exist." + } + } + } + }, + "/districts": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts.", + "operationId": "getDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found districts, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/districtCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + } + }, + "/familyHomes/{id}/relationships/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + } + } + }, + "components": { + "schemas": { + "attributesInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "required": [ + "ownerName" + ], + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/attributesInCreateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInCreateFamilyHomeRequest", + "mansions": "#/components/schemas/attributesInCreateMansionRequest", + "residences": "#/components/schemas/attributesInCreateResidenceRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + }, + { + "required": [ + "numberOfResidents" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "buildings": "#/components/schemas/attributesInBuildingResponse", + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse", + "districts": "#/components/schemas/attributesInDistrictResponse", + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse", + "roads": "#/components/schemas/attributesInRoadResponse", + "rooms": "#/components/schemas/attributesInRoomResponse", + "staffMembers": "#/components/schemas/attributesInStaffMemberResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + }, + "attributesInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/attributesInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/attributesInUpdateMansionRequest", + "residences": "#/components/schemas/attributesInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "createBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "cyclePathIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInDistrictResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInDistrictResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/dataInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "districtCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInDistrictResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "primaryBuildingResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryCyclePathResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCyclePathResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/relationshipsInCreateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInCreateFamilyHomeRequest", + "mansions": "#/components/schemas/relationshipsInCreateMansionRequest", + "residences": "#/components/schemas/relationshipsInCreateResidenceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInResponse" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "buildings": "#/components/schemas/relationshipsInBuildingResponse", + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse", + "districts": "#/components/schemas/relationshipsInDistrictResponse", + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse", + "roads": "#/components/schemas/relationshipsInRoadResponse", + "rooms": "#/components/schemas/relationshipsInRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + }, + "relationshipsInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/relationshipsInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/relationshipsInUpdateMansionRequest", + "residences": "#/components/schemas/relationshipsInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "buildings": "#/components/schemas/dataInCreateBuildingRequest", + "familyHomes": "#/components/schemas/dataInCreateFamilyHomeRequest", + "mansions": "#/components/schemas/dataInCreateMansionRequest", + "residences": "#/components/schemas/dataInCreateResidenceRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "buildings": "#/components/schemas/dataInBuildingResponse", + "cyclePaths": "#/components/schemas/dataInCyclePathResponse", + "districts": "#/components/schemas/dataInDistrictResponse", + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse", + "roads": "#/components/schemas/dataInRoadResponse", + "rooms": "#/components/schemas/dataInRoomResponse", + "staffMembers": "#/components/schemas/dataInStaffMemberResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "buildings": "#/components/schemas/dataInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/dataInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/dataInUpdateMansionRequest", + "residences": "#/components/schemas/dataInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "cyclePaths", + "districts", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "roads", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roadIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roadResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/cyclePathIdentifierInResponse" + } + } + }, + "roadResourceType": { + "enum": [ + "cyclePaths", + "roads" + ], + "type": "string" + }, + "roomIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyBuildingInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousEndpointFilter.cs new file mode 100644 index 0000000000..1675f08197 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousEndpointFilter.cs @@ -0,0 +1,21 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using OpenApiTests.ResourceInheritance.Models; + +namespace OpenApiTests.ResourceInheritance.SubsetOfVarious; + +public sealed class SubsetOfVariousEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return resourceType.ClrType.Name switch + { + nameof(District) => endpoint == JsonApiEndpoints.GetCollection, + nameof(Building) => endpoint is JsonApiEndpoints.Post or JsonApiEndpoints.Patch, + nameof(FamilyHome) => endpoint is JsonApiEndpoints.GetRelationship, + nameof(CyclePath) => endpoint is JsonApiEndpoints.GetSingle, + _ => false + }; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousInheritanceTests.cs new file mode 100644 index 0000000000..069d4be369 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousInheritanceTests.cs @@ -0,0 +1,322 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; + +namespace OpenApiTests.ResourceInheritance.SubsetOfVarious; + +public sealed class SubsetOfVariousInheritanceTests : ResourceInheritanceTests +{ + public SubsetOfVariousInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext) + : base(testContext, false, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.GetCollection)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.Post | JsonApiEndpoints.Patch)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.GetRelationship)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.GetSingle)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(false)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, "familyHomes|mansions|residences|buildings")] + [InlineData("resourceInUpdateRequest", false, "familyHomes|mansions|residences|buildings")] + [InlineData("identifierInRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("attributesInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("relationshipsInCreateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("relationshipsInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", null)] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", null)] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", null)] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, null)] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, null, null)] + [InlineData("residenceIdentifierInRequest", false, null, null)] + [InlineData("familyHomeIdentifierInRequest", false, null, null)] + [InlineData("mansionIdentifierInRequest", false, null, null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, null, null)] + [InlineData("createFamilyHomeOperation", false, null, null)] + [InlineData("createMansionOperation", false, null, null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, null, null)] + [InlineData("updateFamilyHomeOperation", false, null, null)] + [InlineData("updateMansionOperation", false, null, null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionStaffRelationshipOperation", false, null, null)] + [InlineData("addToResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionStaffRelationshipOperation", false, null, null)] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, null, null)] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, null, null)] + [InlineData("dataInCreateBathroomRequest", false, null, null)] + [InlineData("dataInCreateBedroomRequest", false, null, null)] + [InlineData("dataInCreateKitchenRequest", false, null, null)] + [InlineData("dataInCreateLivingRoomRequest", false, null, null)] + [InlineData("dataInCreateToiletRequest", false, null, null)] + [InlineData("dataInUpdateRoomRequest", true, null, null)] + [InlineData("dataInUpdateBathroomRequest", false, null, null)] + [InlineData("dataInUpdateBedroomRequest", false, null, null)] + [InlineData("dataInUpdateKitchenRequest", false, null, null)] + [InlineData("dataInUpdateLivingRoomRequest", false, null, null)] + [InlineData("dataInUpdateToiletRequest", false, null, null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, null, null)] + [InlineData("attributesInCreateBathroomRequest", false, null, null)] + [InlineData("attributesInCreateBedroomRequest", false, null, null)] + [InlineData("attributesInCreateKitchenRequest", false, null, null)] + [InlineData("attributesInCreateLivingRoomRequest", false, null, null)] + [InlineData("attributesInCreateToiletRequest", false, null, null)] + [InlineData("attributesInUpdateRoomRequest", true, null, null)] + [InlineData("attributesInUpdateBathroomRequest", false, null, null)] + [InlineData("attributesInUpdateBedroomRequest", false, null, null)] + [InlineData("attributesInUpdateKitchenRequest", false, null, null)] + [InlineData("attributesInUpdateLivingRoomRequest", false, null, null)] + [InlineData("attributesInUpdateToiletRequest", false, null, null)] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, null, null)] + [InlineData("relationshipsInCreateBathroomRequest", false, null, null)] + [InlineData("relationshipsInCreateBedroomRequest", false, null, null)] + [InlineData("relationshipsInCreateKitchenRequest", false, null, null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInCreateToiletRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoomRequest", true, null, null)] + [InlineData("relationshipsInUpdateBathroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, null, null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInUpdateToiletRequest", false, null, null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, null, null)] + [InlineData("createBedroomOperation", false, null, null)] + [InlineData("createKitchenOperation", false, null, null)] + [InlineData("createLivingRoomOperation", false, null, null)] + [InlineData("createToiletOperation", false, null, null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBathroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, null, null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, null, null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, null, null)] + [InlineData("cyclePathIdentifierInRequest", false, null, null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousOperationFilter.cs new file mode 100644 index 0000000000..8543e1d86f --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousOperationFilter.cs @@ -0,0 +1,36 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using OpenApiTests.ResourceInheritance.Models; + +namespace OpenApiTests.ResourceInheritance.SubsetOfVarious; + +public sealed class SubsetOfVariousOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + Type resourceClrType = resourceType.ClrType; + + if (resourceClrType == typeof(District)) + { + return JsonApiEndpoints.GetCollection; + } + + if (resourceClrType == typeof(Building)) + { + return JsonApiEndpoints.Post | JsonApiEndpoints.Patch; + } + + if (resourceClrType == typeof(FamilyHome)) + { + return JsonApiEndpoints.GetRelationship; + } + + if (resourceClrType == typeof(CyclePath)) + { + return JsonApiEndpoints.GetSingle; + } + + return JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json index ca383f3b8e..51cc607974 100644 --- a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json @@ -53,7 +53,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/dataStreamCollectionResponseDocument" } @@ -75,7 +75,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -207,9 +207,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/dataStreamPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryDataStreamResponseDocument" } } } @@ -229,7 +229,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -239,7 +239,7 @@ "404": { "description": "The dataStream does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -374,7 +374,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/readOnlyChannelCollectionResponseDocument" } @@ -396,7 +396,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -528,9 +528,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/readOnlyChannelPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryReadOnlyChannelResponseDocument" } } } @@ -550,7 +550,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -560,7 +560,7 @@ "404": { "description": "The readOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -706,7 +706,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/dataStreamCollectionResponseDocument" } @@ -728,7 +728,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -738,7 +738,7 @@ "404": { "description": "The readOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -884,7 +884,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/dataStreamIdentifierCollectionResponseDocument" } @@ -906,7 +906,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -916,7 +916,7 @@ "404": { "description": "The readOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1062,9 +1062,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableDataStreamSecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryDataStreamResponseDocument" } } } @@ -1084,7 +1084,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1094,7 +1094,7 @@ "404": { "description": "The readOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1240,7 +1240,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableDataStreamIdentifierResponseDocument" } @@ -1262,7 +1262,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1272,7 +1272,7 @@ "404": { "description": "The readOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1418,9 +1418,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/dataStreamSecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryDataStreamResponseDocument" } } } @@ -1440,7 +1440,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1450,7 +1450,7 @@ "404": { "description": "The readOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1596,7 +1596,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/dataStreamIdentifierResponseDocument" } @@ -1618,7 +1618,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1628,7 +1628,7 @@ "404": { "description": "The readOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1763,7 +1763,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/readOnlyResourceChannelCollectionResponseDocument" } @@ -1785,7 +1785,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1917,9 +1917,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/readOnlyResourceChannelPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryReadOnlyResourceChannelResponseDocument" } } } @@ -1939,7 +1939,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -1949,7 +1949,7 @@ "404": { "description": "The readOnlyResourceChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2095,7 +2095,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/dataStreamCollectionResponseDocument" } @@ -2117,7 +2117,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2127,7 +2127,7 @@ "404": { "description": "The readOnlyResourceChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2273,9 +2273,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/nullableDataStreamSecondaryResponseDocument" + "$ref": "#/components/schemas/nullableSecondaryDataStreamResponseDocument" } } } @@ -2295,7 +2295,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2305,7 +2305,7 @@ "404": { "description": "The readOnlyResourceChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2451,9 +2451,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/dataStreamSecondaryResponseDocument" + "$ref": "#/components/schemas/secondaryDataStreamResponseDocument" } } } @@ -2473,7 +2473,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2483,7 +2483,7 @@ "404": { "description": "The readOnlyResourceChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2629,7 +2629,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/dataStreamIdentifierCollectionResponseDocument" } @@ -2651,7 +2651,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2661,7 +2661,7 @@ "404": { "description": "The relationshipChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2774,7 +2774,7 @@ "requestBody": { "description": "The identities of the dataStreams to add to the audioStreams relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2793,7 +2793,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2803,7 +2803,7 @@ "404": { "description": "The relationshipChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2813,7 +2813,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2823,7 +2823,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2854,7 +2854,7 @@ "requestBody": { "description": "The identities of the dataStreams to assign to the audioStreams relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2873,7 +2873,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2883,7 +2883,7 @@ "404": { "description": "The relationshipChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2893,7 +2893,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2903,7 +2903,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2934,7 +2934,7 @@ "requestBody": { "description": "The identities of the dataStreams to remove from the audioStreams relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -2953,7 +2953,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2963,7 +2963,7 @@ "404": { "description": "The relationshipChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2973,7 +2973,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -2983,7 +2983,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3047,7 +3047,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/nullableDataStreamIdentifierResponseDocument" } @@ -3069,7 +3069,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3079,7 +3079,7 @@ "404": { "description": "The relationshipChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3192,7 +3192,7 @@ "requestBody": { "description": "The identity of the dataStream to assign to the ultraHighDefinitionVideoStream relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3211,7 +3211,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3221,7 +3221,7 @@ "404": { "description": "The relationshipChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3231,7 +3231,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3241,7 +3241,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3305,7 +3305,7 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/dataStreamIdentifierResponseDocument" } @@ -3327,7 +3327,7 @@ "400": { "description": "The query string is invalid.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3337,7 +3337,7 @@ "404": { "description": "The relationshipChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3450,7 +3450,7 @@ "requestBody": { "description": "The identity of the dataStream to assign to the videoStream relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3469,7 +3469,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3479,7 +3479,7 @@ "404": { "description": "The relationshipChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3489,7 +3489,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3499,7 +3499,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3534,7 +3534,7 @@ "requestBody": { "description": "The attributes and relationships of the writeOnlyChannel to create.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3560,9 +3560,9 @@ } }, "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/writeOnlyChannelPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryWriteOnlyChannelResponseDocument" } } } @@ -3573,7 +3573,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3583,7 +3583,7 @@ "403": { "description": "Client-generated IDs cannot be used at this endpoint.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3593,7 +3593,7 @@ "404": { "description": "A related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3603,7 +3603,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3613,7 +3613,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3659,7 +3659,7 @@ "requestBody": { "description": "The attributes and relationships of the writeOnlyChannel to update. Omitted fields are left unchanged.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3675,9 +3675,9 @@ "200": { "description": "The writeOnlyChannel was successfully updated, which resulted in additional changes. The updated writeOnlyChannel is returned.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { - "$ref": "#/components/schemas/writeOnlyChannelPrimaryResponseDocument" + "$ref": "#/components/schemas/primaryWriteOnlyChannelResponseDocument" } } } @@ -3688,7 +3688,7 @@ "400": { "description": "The query string is invalid or the request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3698,7 +3698,7 @@ "404": { "description": "The writeOnlyChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3708,7 +3708,7 @@ "409": { "description": "A resource type or identifier in the request body is incompatible.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3718,7 +3718,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3753,7 +3753,7 @@ "404": { "description": "The writeOnlyChannel does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3786,7 +3786,7 @@ "requestBody": { "description": "The identities of the dataStreams to add to the audioStreams relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3805,7 +3805,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3815,7 +3815,7 @@ "404": { "description": "The writeOnlyChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3825,7 +3825,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3835,7 +3835,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3866,7 +3866,7 @@ "requestBody": { "description": "The identities of the dataStreams to assign to the audioStreams relationship, or an empty array to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3885,7 +3885,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3895,7 +3895,7 @@ "404": { "description": "The writeOnlyChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3905,7 +3905,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3915,7 +3915,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3946,7 +3946,7 @@ "requestBody": { "description": "The identities of the dataStreams to remove from the audioStreams relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -3965,7 +3965,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3975,7 +3975,7 @@ "404": { "description": "The writeOnlyChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3985,7 +3985,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -3995,7 +3995,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4028,7 +4028,7 @@ "requestBody": { "description": "The identity of the dataStream to assign to the ultraHighDefinitionVideoStream relationship, or `null` to clear the relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4047,7 +4047,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4057,7 +4057,7 @@ "404": { "description": "The writeOnlyChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4067,7 +4067,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4077,7 +4077,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4110,7 +4110,7 @@ "requestBody": { "description": "The identity of the dataStream to assign to the videoStream relationship.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "allOf": [ { @@ -4129,7 +4129,7 @@ "400": { "description": "The request body is missing or malformed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4139,7 +4139,7 @@ "404": { "description": "The writeOnlyChannel or a related resource does not exist.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4149,7 +4149,7 @@ "409": { "description": "The request body contains conflicting information or another resource with the same ID already exists.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4159,7 +4159,7 @@ "422": { "description": "Validation of the request body failed.", "content": { - "application/vnd.api+json": { + "application/vnd.api+json; ext=openapi": { "schema": { "$ref": "#/components/schemas/errorResponseDocument" } @@ -4172,165 +4172,236 @@ }, "components": { "schemas": { - "attributesInCreateWriteOnlyChannelRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "isCommercial": { - "type": "boolean", - "nullable": true - }, - "isAdultOnly": { - "type": "boolean", - "nullable": true - } - }, - "additionalProperties": false - }, - "attributesInUpdateWriteOnlyChannelRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "isCommercial": { - "type": "boolean", - "nullable": true - }, - "isAdultOnly": { - "type": "boolean", - "nullable": true - } - }, - "additionalProperties": false - }, - "createWriteOnlyChannelRequestDocument": { + "attributesInCreateRequest": { "required": [ - "data" + "openapi:discriminator" ], "type": "object", "properties": { - "data": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/dataInCreateWriteOnlyChannelRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/attributesInCreateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInCreateWriteOnlyChannelRequest": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "allOf": [ - { - "$ref": "#/components/schemas/writeOnlyChannelResourceType" - } - ] + "attributesInDataStreamResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInCreateWriteOnlyChannelRequest" + { + "type": "object", + "properties": { + "bytesTransmitted": { + "type": "integer", + "format": "int64" } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInReadOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/relationshipsInCreateWriteOnlyChannelRequest" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInReadOnlyResourceChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataInResponse": { + "attributesInResponse": { "required": [ - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { "$ref": "#/components/schemas/resourceType" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false, "discriminator": { - "propertyName": "type", + "propertyName": "openapi:discriminator", "mapping": { - "dataStreams": "#/components/schemas/dataStreamDataInResponse", - "readOnlyChannels": "#/components/schemas/readOnlyChannelDataInResponse", - "readOnlyResourceChannels": "#/components/schemas/readOnlyResourceChannelDataInResponse", - "writeOnlyChannels": "#/components/schemas/writeOnlyChannelDataInResponse" + "dataStreams": "#/components/schemas/attributesInDataStreamResponse", + "readOnlyChannels": "#/components/schemas/attributesInReadOnlyChannelResponse", + "readOnlyResourceChannels": "#/components/schemas/attributesInReadOnlyResourceChannelResponse", + "writeOnlyChannels": "#/components/schemas/attributesInWriteOnlyChannelResponse" } }, "x-abstract": true }, - "dataInUpdateWriteOnlyChannelRequest": { + "attributesInUpdateRequest": { "required": [ - "id", - "type" + "openapi:discriminator" ], "type": "object", "properties": { - "type": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/writeOnlyChannelResourceType" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/attributesInUpdateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/attributesInUpdateWriteOnlyChannelRequest" + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInWriteOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" }, - "relationships": { + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createWriteOnlyChannelRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipsInUpdateWriteOnlyChannelRequest" + "$ref": "#/components/schemas/dataInCreateWriteOnlyChannelRequest" } ] }, @@ -4344,56 +4415,198 @@ }, "additionalProperties": false }, - "dataStreamAttributesInResponse": { + "dataInCreateWriteOnlyChannelRequest": { "type": "object", - "properties": { - "bytesTransmitted": { - "type": "integer", - "format": "int64" + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateWriteOnlyChannelRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateWriteOnlyChannelRequest" + } + ] + } + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataStreamCollectionResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + "dataInDataStreamResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInDataStreamResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInReadOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataStreamDataInResponse" - } + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInReadOnlyChannelResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInReadOnlyChannelResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInReadOnlyResourceChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInReadOnlyResourceChannelResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInReadOnlyResourceChannelResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateWriteOnlyChannelRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateWriteOnlyChannelRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateWriteOnlyChannelRequest" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, - "dataStreamDataInResponse": { + "dataInWriteOnlyChannelResponse": { "allOf": [ { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" }, { "required": [ @@ -4409,7 +4622,14 @@ "attributes": { "allOf": [ { - "$ref": "#/components/schemas/dataStreamAttributesInResponse" + "$ref": "#/components/schemas/attributesInWriteOnlyChannelResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInWriteOnlyChannelResponse" } ] }, @@ -4426,7 +4646,7 @@ ], "additionalProperties": false }, - "dataStreamIdentifierCollectionResponseDocument": { + "dataStreamCollectionResponseDocument": { "required": [ "data", "links" @@ -4436,14 +4656,20 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, "data": { "type": "array", "items": { - "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + "$ref": "#/components/schemas/dataInDataStreamResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4456,24 +4682,25 @@ }, "additionalProperties": false }, - "dataStreamIdentifierInRequest": { + "dataStreamIdentifierCollectionResponseDocument": { "required": [ - "id", - "type" + "data", + "links" ], "type": "object", "properties": { - "type": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/dataStreamResourceType" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, - "id": { - "minLength": 1, - "type": "string", - "format": "int64" + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } }, "meta": { "allOf": [ @@ -4485,6 +4712,29 @@ }, "additionalProperties": false }, + "dataStreamIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, "dataStreamIdentifierInResponse": { "required": [ "id", @@ -4545,86 +4795,12 @@ }, "additionalProperties": false }, - "dataStreamPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataStreamDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "dataStreamResourceType": { "enum": [ "dataStreams" ], "type": "string" }, - "dataStreamSecondaryResponseDocument": { - "required": [ - "data", - "links" - ], - "type": "object", - "properties": { - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceTopLevelLinks" - } - ] - }, - "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataStreamDataInResponse" - } - ] - }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, "errorLinks": { "type": "object", "properties": { @@ -4747,6 +4923,36 @@ }, "additionalProperties": false }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "dataStreams": "#/components/schemas/dataStreamIdentifierInRequest" + } + }, + "x-abstract": true + }, "meta": { "type": "object", "additionalProperties": { @@ -4785,7 +4991,7 @@ }, "additionalProperties": false }, - "nullableDataStreamSecondaryResponseDocument": { + "nullableSecondaryDataStreamResponseDocument": { "required": [ "data", "links" @@ -4802,7 +5008,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/dataStreamDataInResponse" + "$ref": "#/components/schemas/dataInDataStreamResponse" } ], "nullable": true @@ -4810,7 +5016,7 @@ "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -4875,25 +5081,7 @@ }, "additionalProperties": false }, - "readOnlyChannelAttributesInResponse": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "isCommercial": { - "type": "boolean", - "nullable": true - }, - "isAdultOnly": { - "type": "boolean", - "nullable": true - } - }, - "additionalProperties": false - }, - "readOnlyChannelCollectionResponseDocument": { + "primaryDataStreamResponseDocument": { "required": [ "data", "links" @@ -4903,76 +5091,34 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/readOnlyChannelDataInResponse" - } + "allOf": [ + { + "$ref": "#/components/schemas/dataInDataStreamResponse" + } + ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { "allOf": [ { "$ref": "#/components/schemas/meta" - } - ] - } - }, - "additionalProperties": false - }, - "readOnlyChannelDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/readOnlyChannelAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/readOnlyChannelRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false + } + ] } - ], + }, "additionalProperties": false }, - "readOnlyChannelPrimaryResponseDocument": { + "primaryReadOnlyChannelResponseDocument": { "required": [ "data", "links" @@ -4989,14 +5135,14 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/readOnlyChannelDataInResponse" + "$ref": "#/components/schemas/dataInReadOnlyChannelResponse" } ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -5009,52 +5155,44 @@ }, "additionalProperties": false }, - "readOnlyChannelRelationshipsInResponse": { + "primaryReadOnlyResourceChannelResponseDocument": { + "required": [ + "data", + "links" + ], "type": "object", "properties": { - "videoStream": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/toOneDataStreamInResponse" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, - "ultraHighDefinitionVideoStream": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + "$ref": "#/components/schemas/dataInReadOnlyResourceChannelResponse" } ] }, - "audioStreams": { + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyDataStreamInResponse" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false }, - "readOnlyResourceChannelAttributesInResponse": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "isCommercial": { - "type": "boolean", - "nullable": true - }, - "isAdultOnly": { - "type": "boolean", - "nullable": true - } - }, - "additionalProperties": false - }, - "readOnlyResourceChannelCollectionResponseDocument": { + "primaryWriteOnlyChannelResponseDocument": { "required": [ "data", "links" @@ -5064,20 +5202,21 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/readOnlyResourceChannelDataInResponse" - } + "allOf": [ + { + "$ref": "#/components/schemas/dataInWriteOnlyChannelResponse" + } + ] }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -5090,50 +5229,7 @@ }, "additionalProperties": false }, - "readOnlyResourceChannelDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/readOnlyResourceChannelAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/readOnlyResourceChannelRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, - "readOnlyResourceChannelPrimaryResponseDocument": { + "readOnlyChannelCollectionResponseDocument": { "required": [ "data", "links" @@ -5143,21 +5239,20 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/readOnlyResourceChannelDataInResponse" - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInReadOnlyChannelResponse" + } }, "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -5170,27 +5265,36 @@ }, "additionalProperties": false }, - "readOnlyResourceChannelRelationshipsInResponse": { + "readOnlyResourceChannelCollectionResponseDocument": { + "required": [ + "data", + "links" + ], "type": "object", "properties": { - "videoStream": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/toOneDataStreamInResponse" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, - "ultraHighDefinitionVideoStream": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" - } - ] + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInReadOnlyResourceChannelResponse" + } }, - "audioStreams": { + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyDataStreamInResponse" + "$ref": "#/components/schemas/meta" } ] } @@ -5209,61 +5313,253 @@ }, "additionalProperties": false }, - "relationshipsInCreateWriteOnlyChannelRequest": { + "relationshipsInCreateRequest": { "required": [ - "videoStream" + "openapi:discriminator" ], "type": "object", "properties": { - "videoStream": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneDataStreamInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/relationshipsInCreateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" }, - "ultraHighDefinitionVideoStream": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + { + "required": [ + "videoStream" + ], + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInRequest" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInReadOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInResponse" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInReadOnlyResourceChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "audioStreams": { + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInResponse" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toManyDataStreamInRequest" + "$ref": "#/components/schemas/resourceType" } ] } }, - "additionalProperties": false + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "readOnlyChannels": "#/components/schemas/relationshipsInReadOnlyChannelResponse", + "readOnlyResourceChannels": "#/components/schemas/relationshipsInReadOnlyResourceChannelResponse", + "writeOnlyChannels": "#/components/schemas/relationshipsInWriteOnlyChannelResponse" + } + }, + "x-abstract": true }, - "relationshipsInUpdateWriteOnlyChannelRequest": { + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], "type": "object", "properties": { - "videoStream": { + "openapi:discriminator": { "allOf": [ { - "$ref": "#/components/schemas/toOneDataStreamInRequest" + "$ref": "#/components/schemas/resourceType" } ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/relationshipsInUpdateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" }, - "ultraHighDefinitionVideoStream": { - "allOf": [ - { - "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInRequest" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] } - ] + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInWriteOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" }, - "audioStreams": { - "allOf": [ - { - "$ref": "#/components/schemas/toManyDataStreamInRequest" + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInResponse" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInResponse" + } + ] } - ] + }, + "additionalProperties": false } - }, + ], "additionalProperties": false }, "resourceCollectionTopLevelLinks": { @@ -5332,6 +5628,99 @@ }, "additionalProperties": false }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "writeOnlyChannels": "#/components/schemas/dataInCreateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "dataStreams": "#/components/schemas/dataInDataStreamResponse", + "readOnlyChannels": "#/components/schemas/dataInReadOnlyChannelResponse", + "readOnlyResourceChannels": "#/components/schemas/dataInReadOnlyResourceChannelResponse", + "writeOnlyChannels": "#/components/schemas/dataInWriteOnlyChannelResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "writeOnlyChannels": "#/components/schemas/dataInUpdateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, "resourceLinks": { "type": "object", "properties": { @@ -5362,42 +5751,31 @@ ], "type": "string" }, - "toManyDataStreamInRequest": { + "secondaryDataStreamResponseDocument": { "required": [ - "data" + "data", + "links" ], "type": "object", "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataStreamIdentifierInRequest" - } - }, - "meta": { + "links": { "allOf": [ { - "$ref": "#/components/schemas/meta" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] - } - }, - "additionalProperties": false - }, - "toManyDataStreamInResponse": { - "type": "object", - "properties": { - "links": { + }, + "data": { "allOf": [ { - "$ref": "#/components/schemas/relationshipLinks" + "$ref": "#/components/schemas/dataInDataStreamResponse" } ] }, - "data": { + "included": { "type": "array", "items": { - "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + "$ref": "#/components/schemas/resourceInResponse" } }, "meta": { @@ -5410,18 +5788,17 @@ }, "additionalProperties": false }, - "toOneDataStreamInRequest": { + "toManyDataStreamInRequest": { "required": [ "data" ], "type": "object", "properties": { "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataStreamIdentifierInRequest" - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/dataStreamIdentifierInRequest" + } }, "meta": { "allOf": [ @@ -5433,7 +5810,7 @@ }, "additionalProperties": false }, - "toOneDataStreamInResponse": { + "toManyDataStreamInResponse": { "type": "object", "properties": { "links": { @@ -5444,11 +5821,10 @@ ] }, "data": { - "allOf": [ - { - "$ref": "#/components/schemas/dataStreamIdentifierInResponse" - } - ] + "type": "array", + "items": { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } }, "meta": { "allOf": [ @@ -5460,7 +5836,7 @@ }, "additionalProperties": false }, - "updateWriteOnlyChannelRequestDocument": { + "toOneDataStreamInRequest": { "required": [ "data" ], @@ -5469,7 +5845,7 @@ "data": { "allOf": [ { - "$ref": "#/components/schemas/dataInUpdateWriteOnlyChannelRequest" + "$ref": "#/components/schemas/dataStreamIdentifierInRequest" } ] }, @@ -5483,94 +5859,23 @@ }, "additionalProperties": false }, - "writeOnlyChannelAttributesInResponse": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "isCommercial": { - "type": "boolean", - "nullable": true - }, - "isAdultOnly": { - "type": "boolean", - "nullable": true - } - }, - "additionalProperties": false - }, - "writeOnlyChannelDataInResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/dataInResponse" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "minLength": 1, - "type": "string", - "format": "int64" - }, - "attributes": { - "allOf": [ - { - "$ref": "#/components/schemas/writeOnlyChannelAttributesInResponse" - } - ] - }, - "relationships": { - "allOf": [ - { - "$ref": "#/components/schemas/writeOnlyChannelRelationshipsInResponse" - } - ] - }, - "links": { - "allOf": [ - { - "$ref": "#/components/schemas/resourceLinks" - } - ] - } - }, - "additionalProperties": false - } - ], - "additionalProperties": false - }, - "writeOnlyChannelPrimaryResponseDocument": { - "required": [ - "data", - "links" - ], + "toOneDataStreamInResponse": { "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/resourceTopLevelLinks" + "$ref": "#/components/schemas/relationshipLinks" } ] }, "data": { "allOf": [ { - "$ref": "#/components/schemas/writeOnlyChannelDataInResponse" + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" } ] }, - "included": { - "type": "array", - "items": { - "$ref": "#/components/schemas/dataInResponse" - } - }, "meta": { "allOf": [ { @@ -5581,38 +5886,28 @@ }, "additionalProperties": false }, - "writeOnlyChannelRelationshipsInResponse": { + "updateWriteOnlyChannelRequestDocument": { + "required": [ + "data" + ], "type": "object", "properties": { - "videoStream": { - "allOf": [ - { - "$ref": "#/components/schemas/toOneDataStreamInResponse" - } - ] - }, - "ultraHighDefinitionVideoStream": { + "data": { "allOf": [ { - "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + "$ref": "#/components/schemas/dataInUpdateWriteOnlyChannelRequest" } ] }, - "audioStreams": { + "meta": { "allOf": [ { - "$ref": "#/components/schemas/toManyDataStreamInResponse" + "$ref": "#/components/schemas/meta" } ] } }, "additionalProperties": false - }, - "writeOnlyChannelResourceType": { - "enum": [ - "writeOnlyChannels" - ], - "type": "string" } } }